Commits

Anonymous committed d37908d

Fix ordering of imports (as per PEP-8) and make sure there are no mutable
default arguments

Comments (0)

Files changed (4)

MoinMoin/apps/admin/_tests/test_admin.py

 from flask import url_for
 
 class TestAdmin(object):
-    def _test_view_get(self, viewname, status='200 OK', data=['<html>', '</html>'], viewopts={}):
+    def _test_view_get(self, url, status='200 OK', data=('<html>', '</html>')):
         with self.app.test_client() as c:
-            rv = c.get(url_for(viewname, **viewopts))
+            rv = c.get(url)
             assert rv.status == status
             assert rv.headers['Content-Type'] == 'text/html; charset=utf-8'
             for item in data: assert item in rv.data
 
     def test_index(self):
-        self._test_view_get('admin.index')
+        self._test_view_get(url_for('admin.index'))
 
     def test_userprofile(self):
-        self._test_view_get('admin.userprofile', status='403 FORBIDDEN', viewopts=dict(user_name='DoesntExist'))
+        self._test_view_get(url_for('admin.userprofile', user_name='DoesntExist'), status='403 FORBIDDEN')
 
     def test_wikiconfig(self):
-        self._test_view_get('admin.wikiconfig', status='403 FORBIDDEN')
+        self._test_view_get(url_for('admin.wikiconfig'), status='403 FORBIDDEN')
 
     def test_wikiconfighelp(self):
-        self._test_view_get('admin.wikiconfighelp', status='403 FORBIDDEN')
+        self._test_view_get(url_for('admin.wikiconfighelp'), status='403 FORBIDDEN')
 
     def test_interwikihelp(self):
-        self._test_view_get('admin.interwikihelp')
+        self._test_view_get(url_for('admin.interwikihelp'))
 
     def test_highlighterhelp(self):
-        self._test_view_get('admin.highlighterhelp')
+        self._test_view_get(url_for('admin.highlighterhelp'))
 
     def test_itemsize(self):
-        self._test_view_get('admin.itemsize')
+        self._test_view_get(url_for('admin.itemsize'))
 

MoinMoin/apps/feed/_tests/test_feed.py

 
 from flask import url_for
 
-from MoinMoin._tests import wikiconfig
-
 from MoinMoin.items import Item
 from MoinMoin.config import CONTENTTYPE, COMMENT
-from MoinMoin._tests import update_item
+from MoinMoin._tests import update_item, wikiconfig
 
 class TestFeeds(object):
     class Config(wikiconfig.Config):

MoinMoin/apps/frontend/_tests/test_frontend.py

 
 from flask import url_for
 from flask import g as flaskg
+import pytest
 from werkzeug import ImmutableMultiDict, FileStorage
 
 from MoinMoin.apps.frontend import views
 from MoinMoin import user
 from MoinMoin.util import crypto
 from MoinMoin._tests import wikiconfig
-import pytest
 
 class TestFrontend(object):
-    def _test_view(self, viewname, status='200 OK', data=['<html>', '</html>'], content_types=['text/html; charset=utf-8'], viewopts={}):
+    def _test_view(self, viewname, status='200 OK', data=('<html>', '</html>'), content_types=('text/html; charset=utf-8', ), **kwargs):
+        if kwargs.get('viewopts'):
+            viewopts = kwargs['viewopts']
+        else:
+            viewopts = {}
         print 'GET %s' % url_for(viewname, **viewopts)
         with self.app.test_client() as c:
             rv = c.get(url_for(viewname, **viewopts))

MoinMoin/apps/misc/_tests/test_misc.py

 
 from MoinMoin._tests import wikiconfig
 
-
 class TestMisc(object):
     class Config(wikiconfig.Config):
         """