From 34e974e360184baef873da55f31379697e367f32 Mon Sep 17 00:00:00 2001 From: Paul Everitt Date: Wed, 25 Sep 2013 12:08:33 -0400 Subject: Get pyramid_chameleon added to the quick tutorial, plus some other fixes for Python 3. --- docs/quick_tutorial/forms/setup.py | 1 + docs/quick_tutorial/forms/tutorial/__init__.py | 1 + docs/quick_tutorial/forms/tutorial/tests.py | 23 ++++++----------------- 3 files changed, 8 insertions(+), 17 deletions(-) (limited to 'docs/quick_tutorial/forms') diff --git a/docs/quick_tutorial/forms/setup.py b/docs/quick_tutorial/forms/setup.py index 5db620eb9..361ade013 100644 --- a/docs/quick_tutorial/forms/setup.py +++ b/docs/quick_tutorial/forms/setup.py @@ -2,6 +2,7 @@ from setuptools import setup requires = [ 'pyramid', + 'pyramid_chameleon', 'deform' ] diff --git a/docs/quick_tutorial/forms/tutorial/__init__.py b/docs/quick_tutorial/forms/tutorial/__init__.py index b12a4154a..dff7457cf 100644 --- a/docs/quick_tutorial/forms/tutorial/__init__.py +++ b/docs/quick_tutorial/forms/tutorial/__init__.py @@ -3,6 +3,7 @@ from pyramid.config import Configurator def main(global_config, **settings): config = Configurator(settings=settings) + config.include('pyramid_chameleon') config.add_route('wiki_view', '/') config.add_route('wikipage_add', '/add') config.add_route('wikipage_view', '/{uid}') diff --git a/docs/quick_tutorial/forms/tutorial/tests.py b/docs/quick_tutorial/forms/tutorial/tests.py index 6ff554a1e..5a2c40904 100644 --- a/docs/quick_tutorial/forms/tutorial/tests.py +++ b/docs/quick_tutorial/forms/tutorial/tests.py @@ -11,25 +11,18 @@ class TutorialViewTests(unittest.TestCase): testing.tearDown() def test_home(self): - from .views import TutorialViews + from .views import WikiViews request = testing.DummyRequest() - inst = TutorialViews(request) - response = inst.home() - self.assertEqual('Home View', response['name']) - - def test_hello(self): - from .views import TutorialViews - - request = testing.DummyRequest() - inst = TutorialViews(request) - response = inst.hello() - self.assertEqual('Hello View', response['name']) + inst = WikiViews(request) + response = inst.wiki_view() + self.assertEqual(len(response['pages']), 3) class TutorialFunctionalTests(unittest.TestCase): def setUp(self): from tutorial import main + app = main({}) from webtest import TestApp @@ -40,8 +33,4 @@ class TutorialFunctionalTests(unittest.TestCase): def test_home(self): res = self.testapp.get('/', status=200) - self.assertIn(b'

Hi Home View', res.body) - - def test_hello(self): - res = self.testapp.get('/howdy', status=200) - self.assertIn(b'

Hi Hello View', res.body) + self.assertIn(b'Wiki: View', res.body) -- cgit v1.2.3