'Test relative path for split courses assets'

def test_relative_url_for_split_course(self):

    with modulestore().default_store(ModuleStoreEnum.Type.split):
        module_store = modulestore()
        course_id = module_store.make_course_key('edX', 'toy', '2012_Fall')
        import_course_from_xml(module_store, self.user.id, TEST_DATA_DIR, ['toy'], static_content_store=contentstore(), target_id=course_id, create_if_not_present=True)
        course = module_store.get_course(course_id)
        filename = 'sample_static.html'
        html_src_attribute = '"/static/{}"'.format(filename)
        asset_url = replace_static_urls(html_src_attribute, course_id=course.id)
        url = asset_url.replace('"', '')
        base_url = url.replace(filename, '')
        self.assertIn('/{}'.format(filename), url)
        resp = self.client.get(url)
        self.assertEquals(resp.status_code, 200)
        relative_path = 'just_a_test.jpg'
        absolute_path = (base_url + relative_path)
        self.assertIn('/{}'.format(relative_path), absolute_path)
        resp = self.client.get(absolute_path)
        self.assertEquals(resp.status_code, 200)
