From bdd23c0eaeccdee010091e08ba966fb4d9e83005 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Wed, 22 May 2013 15:55:21 -0500 Subject: [PATCH] test_plugin_staticdirect now works and passes. This commit sponsored by Samuel Vale. Thank you! --- mediagoblin/tests/test_pluginapi.py | 34 +++++++++++++++++++ .../tests/testplugins/staticstuff/views.py | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/mediagoblin/tests/test_pluginapi.py b/mediagoblin/tests/test_pluginapi.py index 73ad235e..6c1950e5 100644 --- a/mediagoblin/tests/test_pluginapi.py +++ b/mediagoblin/tests/test_pluginapi.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +import json import sys from configobj import ConfigObj @@ -358,3 +359,36 @@ doubleme: happyhappy""" global thing: globally appended! lol: cats doubleme: joyjoy""" + + +@pytest.fixture() +def static_plugin_app(request): + """ + Get a MediaGoblin app fixture using appconfig_static_plugin.ini + """ + return get_app( + request, + mgoblin_config=pkg_resources.resource_filename( + 'mediagoblin.tests', 'appconfig_static_plugin.ini')) + + +def test_plugin_assetlink(static_plugin_app): + """ + Test that the assetlink command works correctly + """ + pass + + +def test_plugin_staticdirect(static_plugin_app): + """ + Test that the staticdirect utilities pull up the right things + """ + result = json.loads( + static_plugin_app.get('/staticstuff/').body) + + assert len(result) == 2 + + assert result['mgoblin_bunny_pic'] == '/test_static/images/bunny_pic.png' + assert result['plugin_bunny_css'] == \ + '/plugin_static/staticstuff/css/bunnify.css' + diff --git a/mediagoblin/tests/testplugins/staticstuff/views.py b/mediagoblin/tests/testplugins/staticstuff/views.py index ff0dd8e6..34a5e8cb 100644 --- a/mediagoblin/tests/testplugins/staticstuff/views.py +++ b/mediagoblin/tests/testplugins/staticstuff/views.py @@ -25,4 +25,4 @@ def static_demo(request): 'mgoblin_bunny_pic': request.staticdirect( 'images/bunny_pic.png'), 'plugin_bunny_css': request.staticdirect( - 'css/bunnyify.css', 'staticstuff')})) + 'css/bunnify.css', 'staticstuff')})) -- 2.25.1