From 13cf2dd2c912c1961d429c8a5756622cf960d5bf Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 7 Oct 2013 19:14:49 -0500 Subject: fix some broken positional args to sqlalchemy models --- docs/tutorials/wiki2/src/authorization/tutorial/scripts/initializedb.py | 2 +- docs/tutorials/wiki2/src/models/tutorial/scripts/initializedb.py | 2 +- docs/tutorials/wiki2/src/tests/tutorial/scripts/initializedb.py | 2 +- docs/tutorials/wiki2/src/views/tutorial/scripts/initializedb.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/tutorials') diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/scripts/initializedb.py b/docs/tutorials/wiki2/src/authorization/tutorial/scripts/initializedb.py index 092e359ce..23a5f13f4 100644 --- a/docs/tutorials/wiki2/src/authorization/tutorial/scripts/initializedb.py +++ b/docs/tutorials/wiki2/src/authorization/tutorial/scripts/initializedb.py @@ -33,5 +33,5 @@ def main(argv=sys.argv): DBSession.configure(bind=engine) Base.metadata.create_all(engine) with transaction.manager: - model = Page('FrontPage', 'This is the front page') + model = Page(name='FrontPage', data='This is the front page') DBSession.add(model) diff --git a/docs/tutorials/wiki2/src/models/tutorial/scripts/initializedb.py b/docs/tutorials/wiki2/src/models/tutorial/scripts/initializedb.py index 092e359ce..23a5f13f4 100644 --- a/docs/tutorials/wiki2/src/models/tutorial/scripts/initializedb.py +++ b/docs/tutorials/wiki2/src/models/tutorial/scripts/initializedb.py @@ -33,5 +33,5 @@ def main(argv=sys.argv): DBSession.configure(bind=engine) Base.metadata.create_all(engine) with transaction.manager: - model = Page('FrontPage', 'This is the front page') + model = Page(name='FrontPage', data='This is the front page') DBSession.add(model) diff --git a/docs/tutorials/wiki2/src/tests/tutorial/scripts/initializedb.py b/docs/tutorials/wiki2/src/tests/tutorial/scripts/initializedb.py index 092e359ce..23a5f13f4 100644 --- a/docs/tutorials/wiki2/src/tests/tutorial/scripts/initializedb.py +++ b/docs/tutorials/wiki2/src/tests/tutorial/scripts/initializedb.py @@ -33,5 +33,5 @@ def main(argv=sys.argv): DBSession.configure(bind=engine) Base.metadata.create_all(engine) with transaction.manager: - model = Page('FrontPage', 'This is the front page') + model = Page(name='FrontPage', data='This is the front page') DBSession.add(model) diff --git a/docs/tutorials/wiki2/src/views/tutorial/scripts/initializedb.py b/docs/tutorials/wiki2/src/views/tutorial/scripts/initializedb.py index 092e359ce..23a5f13f4 100644 --- a/docs/tutorials/wiki2/src/views/tutorial/scripts/initializedb.py +++ b/docs/tutorials/wiki2/src/views/tutorial/scripts/initializedb.py @@ -33,5 +33,5 @@ def main(argv=sys.argv): DBSession.configure(bind=engine) Base.metadata.create_all(engine) with transaction.manager: - model = Page('FrontPage', 'This is the front page') + model = Page(name='FrontPage', data='This is the front page') DBSession.add(model) -- cgit v1.2.3 From 85aef4a4c0157a59bfd7ea9b3a58b842ac4de0f0 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Tue, 8 Oct 2013 19:07:14 -0500 Subject: fix stupid missing named arguments, whyyy --- docs/tutorials/wiki2/src/authorization/tutorial/tests.py | 8 ++++---- docs/tutorials/wiki2/src/authorization/tutorial/views.py | 4 ++-- docs/tutorials/wiki2/src/tests/tutorial/tests.py | 8 ++++---- docs/tutorials/wiki2/src/tests/tutorial/views.py | 4 ++-- docs/tutorials/wiki2/src/views/tutorial/tests.py | 8 ++++---- docs/tutorials/wiki2/src/views/tutorial/views.py | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) (limited to 'docs/tutorials') diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/tests.py b/docs/tutorials/wiki2/src/authorization/tutorial/tests.py index 5dcee127b..9f01d2da5 100644 --- a/docs/tutorials/wiki2/src/authorization/tutorial/tests.py +++ b/docs/tutorials/wiki2/src/authorization/tutorial/tests.py @@ -14,7 +14,7 @@ def _initTestingDB(): Base.metadata.create_all(engine) DBSession.configure(bind=engine) with transaction.manager: - model = Page('FrontPage', 'This is the front page') + model = Page(name='FrontPage', data='This is the front page') DBSession.add(model) return DBSession @@ -59,7 +59,7 @@ class ViewPageTests(unittest.TestCase): from tutorial.models import Page request = testing.DummyRequest() request.matchdict['pagename'] = 'IDoExist' - page = Page('IDoExist', 'Hello CruelWorld IDoExist') + page = Page(name='IDoExist', data='Hello CruelWorld IDoExist') self.session.add(page) _registerRoutes(self.config) info = self._callFUT(request) @@ -126,7 +126,7 @@ class EditPageTests(unittest.TestCase): _registerRoutes(self.config) request = testing.DummyRequest() request.matchdict = {'pagename':'abc'} - page = Page('abc', 'hello') + page = Page(name='abc', data='hello') self.session.add(page) info = self._callFUT(request) self.assertEqual(info['page'], page) @@ -139,7 +139,7 @@ class EditPageTests(unittest.TestCase): request = testing.DummyRequest({'form.submitted':True, 'body':'Hello yo!'}) request.matchdict = {'pagename':'abc'} - page = Page('abc', 'hello') + page = Page(name='abc', data='hello') self.session.add(page) response = self._callFUT(request) self.assertEqual(response.location, 'http://example.com/abc') diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/views.py b/docs/tutorials/wiki2/src/authorization/tutorial/views.py index 0d085b0e2..b6dbbf5f6 100644 --- a/docs/tutorials/wiki2/src/authorization/tutorial/views.py +++ b/docs/tutorials/wiki2/src/authorization/tutorial/views.py @@ -63,12 +63,12 @@ def add_page(request): pagename = request.matchdict['pagename'] if 'form.submitted' in request.params: body = request.params['body'] - page = Page(pagename, body) + page = Page(name=pagename, data=body) DBSession.add(page) return HTTPFound(location = request.route_url('view_page', pagename=pagename)) save_url = request.route_url('add_page', pagename=pagename) - page = Page('', '') + page = Page(name='', data='') return dict(page=page, save_url=save_url, logged_in=authenticated_userid(request)) diff --git a/docs/tutorials/wiki2/src/tests/tutorial/tests.py b/docs/tutorials/wiki2/src/tests/tutorial/tests.py index 3e96d0a82..4ee30685e 100644 --- a/docs/tutorials/wiki2/src/tests/tutorial/tests.py +++ b/docs/tutorials/wiki2/src/tests/tutorial/tests.py @@ -15,7 +15,7 @@ def _initTestingDB(): Base.metadata.create_all(engine) DBSession.configure(bind=engine) with transaction.manager: - model = Page('FrontPage', 'This is the front page') + model = Page(name='FrontPage', data='This is the front page') DBSession.add(model) return DBSession @@ -82,7 +82,7 @@ class ViewPageTests(unittest.TestCase): from tutorial.models import Page request = testing.DummyRequest() request.matchdict['pagename'] = 'IDoExist' - page = Page('IDoExist', 'Hello CruelWorld IDoExist') + page = Page(name='IDoExist', data='Hello CruelWorld IDoExist') self.session.add(page) _registerRoutes(self.config) info = self._callFUT(request) @@ -150,7 +150,7 @@ class EditPageTests(unittest.TestCase): _registerRoutes(self.config) request = testing.DummyRequest() request.matchdict = {'pagename':'abc'} - page = Page('abc', 'hello') + page = Page(name='abc', data='hello') self.session.add(page) info = self._callFUT(request) self.assertEqual(info['page'], page) @@ -163,7 +163,7 @@ class EditPageTests(unittest.TestCase): request = testing.DummyRequest({'form.submitted':True, 'body':'Hello yo!'}) request.matchdict = {'pagename':'abc'} - page = Page('abc', 'hello') + page = Page(name='abc', data='hello') self.session.add(page) response = self._callFUT(request) self.assertEqual(response.location, 'http://example.com/abc') diff --git a/docs/tutorials/wiki2/src/tests/tutorial/views.py b/docs/tutorials/wiki2/src/tests/tutorial/views.py index 0d085b0e2..b6dbbf5f6 100644 --- a/docs/tutorials/wiki2/src/tests/tutorial/views.py +++ b/docs/tutorials/wiki2/src/tests/tutorial/views.py @@ -63,12 +63,12 @@ def add_page(request): pagename = request.matchdict['pagename'] if 'form.submitted' in request.params: body = request.params['body'] - page = Page(pagename, body) + page = Page(name=pagename, data=body) DBSession.add(page) return HTTPFound(location = request.route_url('view_page', pagename=pagename)) save_url = request.route_url('add_page', pagename=pagename) - page = Page('', '') + page = Page(name='', data='') return dict(page=page, save_url=save_url, logged_in=authenticated_userid(request)) diff --git a/docs/tutorials/wiki2/src/views/tutorial/tests.py b/docs/tutorials/wiki2/src/views/tutorial/tests.py index 5dcee127b..9f01d2da5 100644 --- a/docs/tutorials/wiki2/src/views/tutorial/tests.py +++ b/docs/tutorials/wiki2/src/views/tutorial/tests.py @@ -14,7 +14,7 @@ def _initTestingDB(): Base.metadata.create_all(engine) DBSession.configure(bind=engine) with transaction.manager: - model = Page('FrontPage', 'This is the front page') + model = Page(name='FrontPage', data='This is the front page') DBSession.add(model) return DBSession @@ -59,7 +59,7 @@ class ViewPageTests(unittest.TestCase): from tutorial.models import Page request = testing.DummyRequest() request.matchdict['pagename'] = 'IDoExist' - page = Page('IDoExist', 'Hello CruelWorld IDoExist') + page = Page(name='IDoExist', data='Hello CruelWorld IDoExist') self.session.add(page) _registerRoutes(self.config) info = self._callFUT(request) @@ -126,7 +126,7 @@ class EditPageTests(unittest.TestCase): _registerRoutes(self.config) request = testing.DummyRequest() request.matchdict = {'pagename':'abc'} - page = Page('abc', 'hello') + page = Page(name='abc', data='hello') self.session.add(page) info = self._callFUT(request) self.assertEqual(info['page'], page) @@ -139,7 +139,7 @@ class EditPageTests(unittest.TestCase): request = testing.DummyRequest({'form.submitted':True, 'body':'Hello yo!'}) request.matchdict = {'pagename':'abc'} - page = Page('abc', 'hello') + page = Page(name='abc', data='hello') self.session.add(page) response = self._callFUT(request) self.assertEqual(response.location, 'http://example.com/abc') diff --git a/docs/tutorials/wiki2/src/views/tutorial/views.py b/docs/tutorials/wiki2/src/views/tutorial/views.py index 5a9c75a61..42ef77b98 100644 --- a/docs/tutorials/wiki2/src/views/tutorial/views.py +++ b/docs/tutorials/wiki2/src/views/tutorial/views.py @@ -47,12 +47,12 @@ def add_page(request): pagename = request.matchdict['pagename'] if 'form.submitted' in request.params: body = request.params['body'] - page = Page(pagename, body) + page = Page(name=pagename, data=body) DBSession.add(page) return HTTPFound(location = request.route_url('view_page', pagename=pagename)) save_url = request.route_url('add_page', pagename=pagename) - page = Page('', '') + page = Page(name='', data='') return dict(page=page, save_url=save_url) @view_config(route_name='edit_page', renderer='templates/edit.pt') -- cgit v1.2.3 From b474e206c38f417439f994f83637420eb196617e Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 14 Oct 2013 16:05:50 +0200 Subject: make these tests pass on python 3.2+ --- docs/tutorials/wiki/src/tests/tutorial/tests.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'docs/tutorials') diff --git a/docs/tutorials/wiki/src/tests/tutorial/tests.py b/docs/tutorials/wiki/src/tests/tutorial/tests.py index c435a4519..5add04c20 100644 --- a/docs/tutorials/wiki/src/tests/tutorial/tests.py +++ b/docs/tutorials/wiki/src/tests/tutorial/tests.py @@ -158,11 +158,11 @@ class FunctionalTests(unittest.TestCase): def test_FrontPage(self): res = self.testapp.get('/FrontPage', status=200) - self.assertTrue('FrontPage' in res.body) + self.assertTrue(b'FrontPage' in res.body) def test_unexisting_page(self): res = self.testapp.get('/SomePage', status=404) - self.assertTrue('Not Found' in res.body) + self.assertTrue(b'Not Found' in res.body) def test_successful_log_in(self): res = self.testapp.get( self.viewer_login, status=302) @@ -170,48 +170,48 @@ class FunctionalTests(unittest.TestCase): def test_failed_log_in(self): res = self.testapp.get( self.viewer_wrong_login, status=200) - self.assertTrue('login' in res.body) + self.assertTrue(b'login' in res.body) def test_logout_link_present_when_logged_in(self): res = self.testapp.get( self.viewer_login, status=302) res = self.testapp.get('/FrontPage', status=200) - self.assertTrue('Logout' in res.body) + self.assertTrue(b'Logout' in res.body) def test_logout_link_not_present_after_logged_out(self): res = self.testapp.get( self.viewer_login, status=302) res = self.testapp.get('/FrontPage', status=200) res = self.testapp.get('/logout', status=302) - self.assertTrue('Logout' not in res.body) + self.assertTrue(b'Logout' not in res.body) def test_anonymous_user_cannot_edit(self): res = self.testapp.get('/FrontPage/edit_page', status=200) - self.assertTrue('Login' in res.body) + self.assertTrue(b'Login' in res.body) def test_anonymous_user_cannot_add(self): res = self.testapp.get('/add_page/NewPage', status=200) - self.assertTrue('Login' in res.body) + self.assertTrue(b'Login' in res.body) def test_viewer_user_cannot_edit(self): res = self.testapp.get( self.viewer_login, status=302) res = self.testapp.get('/FrontPage/edit_page', status=200) - self.assertTrue('Login' in res.body) + self.assertTrue(b'Login' in res.body) def test_viewer_user_cannot_add(self): res = self.testapp.get( self.viewer_login, status=302) res = self.testapp.get('/add_page/NewPage', status=200) - self.assertTrue('Login' in res.body) + self.assertTrue(b'Login' in res.body) def test_editors_member_user_can_edit(self): res = self.testapp.get( self.editor_login, status=302) res = self.testapp.get('/FrontPage/edit_page', status=200) - self.assertTrue('Editing' in res.body) + self.assertTrue(b'Editing' in res.body) def test_editors_member_user_can_add(self): res = self.testapp.get( self.editor_login, status=302) res = self.testapp.get('/add_page/NewPage', status=200) - self.assertTrue('Editing' in res.body) + self.assertTrue(b'Editing' in res.body) def test_editors_member_user_can_view(self): res = self.testapp.get( self.editor_login, status=302) res = self.testapp.get('/FrontPage', status=200) - self.assertTrue('FrontPage' in res.body) + self.assertTrue(b'FrontPage' in res.body) -- cgit v1.2.3