예제 #1
0
    def test_plain_without_name(self):
        from tutorial.views import TutorialViews

        request = testing.DummyRequest()
        inst = TutorialViews(request)
        response = inst.plain()
        self.assertIn(b'No Name Provided', response.body)
    def test_hello(self):
        from tutorial.views import TutorialViews

        request = testing.DummyRequest()
        inst = TutorialViews(request)
        response = inst.hello()
        self.assertEqual('Hello View', response['name'])
    def test_home(self):
        from tutorial.views import TutorialViews

        request = testing.DummyRequest()
        inst = TutorialViews(request)
        response = inst.home()
        # Our view now returns data
        self.assertEqual('Home View', response['name'])
예제 #4
0
    def test_plain_with_name(self):
        from tutorial.views import TutorialViews

        request = testing.DummyRequest()
        request.GET['name'] = 'Anderson Marques'
        inst = TutorialViews(request)
        response = inst.plain()
        self.assertIn(b'Anderson Marques', response.body)
예제 #5
0
    def test_home(self):
        from tutorial.views import TutorialViews

        request = testing.DummyRequest()
        inst = TutorialViews(request)
        response = inst.home()
        # Our view now returns data
        self.assertEqual(response.status, '302 Found')
예제 #6
0
    def test_home(self):
        from tutorial.views import TutorialViews

        request = testing.DummyRequest()
        request.matchdict['first'] = 'First'
        request.matchdict['last'] = 'Last'
        inst = TutorialViews(request)
        response = inst.home()
        self.assertEqual(response['first'], 'First')
        self.assertEqual(response['last'], 'Last')
    def test_home(self):
        from tutorial.views import TutorialViews

        request = testing.DummyRequest()
        request.matchdict['first'] = 'Anderson'
        request.matchdict['last'] = 'Marques'
        inst = TutorialViews(request)
        response = inst.home()
        self.assertEqual('Anderson', response['first'])
        self.assertEqual('Marques', response['last'])