sampleapp/sampleapp/tests.py
author Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
Tue, 08 Mar 2016 16:12:01 +0100
changeset 11608 259fa3391c7b
parent 11483 7b7ed56bf2fb
permissions -rw-r--r--
keep track of all traceback in error handling, not just the exception message (closes #11689093)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11483
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     1
import unittest
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     2
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     3
from pyramid import testing
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     4
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     5
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     6
class ViewTests(unittest.TestCase):
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     7
    def setUp(self):
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     8
        self.config = testing.setUp()
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     9
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    10
    def tearDown(self):
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    11
        testing.tearDown()
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    12
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    13
    def test_my_view(self):
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    14
        from .views import my_view
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    15
        request = testing.DummyRequest()
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    16
        info = my_view(request)
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    17
        self.assertEqual(info['project'], 'cubi')