コード例 #1
0
 def test_load_related_none_found(self):
     with pytest.raises(AssetException) as e:
         am = AssetManager(keg.current_app)
         am.load_related('_not_there.html')
         assert six.text_type(
             e
         ) == 'Could not find related assets for template: _not_there.html'
コード例 #2
0
ファイル: test_assets.py プロジェクト: guruofgentoo/keg
    def test_load_related(self):
        am = AssetManager(keg.current_app)
        am.load_related('assets_in_template.html')

        assert len(am.content['js']) == 1
        asset_name, filepath, content = am.content['js'].pop()
        assert asset_name == 'assets_in_template.js'
        assert filepath.endswith('keg_apps/templating/templates/assets_in_template.js')
        assert content.strip() == '//assets_in_template js file'

        assert len(am.content['css']) == 1
        asset_name, filepath, content = am.content['css'].pop()
        assert asset_name == 'assets_in_template.css'
        assert filepath.endswith('keg_apps/templating/templates/assets_in_template.css')
        assert content.strip() == '/* assets_in_template css file */'
コード例 #3
0
    def test_load_related(self):
        am = AssetManager(keg.current_app)
        am.load_related('assets_in_template.html')

        assert len(am.content['js']) == 1
        asset_name, filepath, content = am.content['js'].pop()
        assert asset_name == 'assets_in_template.js'
        assert filepath.endswith(
            os.path.join('keg_apps', 'templating', 'templates',
                         'assets_in_template.js'))
        assert content.strip() == '//assets_in_template js file'

        assert len(am.content['css']) == 1
        asset_name, filepath, content = am.content['css'].pop()
        assert asset_name == 'assets_in_template.css'
        assert filepath.endswith(
            os.path.join('keg_apps', 'templating', 'templates',
                         'assets_in_template.css'))
        assert content.strip() == '/* assets_in_template css file */'
コード例 #4
0
    def test_load_single_asset(self):
        am = AssetManager(keg.current_app)
        am.load_related('assets_include_single.html')

        assert len(am.content['js']) == 1
        assert len(am.content['css']) == 0
コード例 #5
0
ファイル: test_assets.py プロジェクト: guruofgentoo/keg
    def test_load_single_asset(self):
        am = AssetManager(keg.current_app)
        am.load_related('assets_include_single.html')

        assert len(am.content['js']) == 1
        assert len(am.content['css']) == 0
コード例 #6
0
ファイル: test_assets.py プロジェクト: guruofgentoo/keg
 def test_load_related_none_found(self):
     with pytest.raises(AssetException) as e:
         am = AssetManager(keg.current_app)
         am.load_related('_not_there.html')
         assert six.text_type(e) == 'Could not find related assets for template: _not_there.html'