test_plugin_staticdirect now works and passes.
authorChristopher Allan Webber <cwebber@dustycloud.org>
Wed, 22 May 2013 20:55:21 +0000 (15:55 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Thu, 23 May 2013 18:33:08 +0000 (13:33 -0500)
This commit sponsored by Samuel Vale.  Thank you!

mediagoblin/tests/test_pluginapi.py
mediagoblin/tests/testplugins/staticstuff/views.py

index 73ad235ec5bff65d09d4ab9be1dfda32b4bfd2a2..6c1950e513c2def59ae756a171b99f3c8310479c 100644 (file)
@@ -14,6 +14,7 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+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'
+
index ff0dd8e67e92117953be267cfca80f7e56e0592e..34a5e8cbd3991ae63f31c0672774ac1d734d7fb9 100644 (file)
@@ -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')}))