def test_get_assets_with_extension(): core.config.update({ 'STATIC_URL': '/static' }) handler = TestHandler() css_assets = handler.get_assets('css') assert isinstance(css_assets, list) assert css_assets == ['/static/fakemodule/fakestyle.css']
def test_get_assets(): core.config.update({ 'STATIC_URL': '/static' }) handler = TestHandler() assets = handler.get_assets() assert assets['css'] == ['/static/fakemodule/fakestyle.css'] assert assets['js'] == ['/static/fakemodule/fakejs/fakescript.js'] assert assets['_'] == ['/static/fakemodule/noextfile']
def test_get_assets_returns_key_error_if_static_url_not_configured(): handler = TestHandler() with pytest.raises(KeyError) as excinfo: handler.get_assets() assert 'STATIC_URL is not configured' in str(excinfo)