@patch('static_replace.staticfiles_storage', autospec=True)
@patch('static_replace.modulestore', autospec=True)
@override_settings(STATIC_URL='https://example.com/static/')
def test_static_url_with_xblock_resource_on_cdn(mock_modulestore, mock_storage):
 mock_storage.exists.return_value = False
 mock_modulestore.return_value = Mock(MongoModuleStore)
 pre_text = 'EMBED src ="https://example.com/static/xblock/resources/tehehe.xblock/public/images/woo.png"'
 post_text = pre_text
 assert_equals(post_text, replace_static_urls(pre_text, DATA_DIRECTORY, COURSE_KEY))

@ patch ( 'static_replace.staticfiles_storage' , autospec = True ) @ patch ( 'static_replace.modulestore' , autospec = True ) @ override_settings ( STATIC_URL = 'https://example.com/static/' ) def test_static_url_with_xblock_resource_on_cdn ( mock_modulestore , mock_storage ) : mock_storage . exists . return_value = False mock_modulestore . return_value = Mock ( MongoModuleStore ) pre_text = 'EMBED src ="https://example.com/static/xblock/resources/tehehe.xblock/public/images/woo.png"' post_text = pre_text assert_equals ( post_text , replace_static_urls ( pre_text , DATA_DIRECTORY , COURSE_KEY ) )
make sure that for urls with xblock resource url .