summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2013-08-10 03:04:18 -0400
committerChris McDonough <chrism@plope.com>2013-08-10 03:04:18 -0400
commit3f8e9a347efc113617c88d1587b24b7cfab7c48c (patch)
tree68883f4372d85054ac4dbdedcc81a7f04bbcdb88
parent881e8e2aa57ea2a77d91c3cd8401395f4a815eb1 (diff)
parentab222cd0a7e4e320ccc2a09062c7b29ee9ead9d5 (diff)
downloadpyramid-3f8e9a347efc113617c88d1587b24b7cfab7c48c.tar.gz
pyramid-3f8e9a347efc113617c88d1587b24b7cfab7c48c.tar.bz2
pyramid-3f8e9a347efc113617c88d1587b24b7cfab7c48c.zip
Merge branch 'junaidali-master'
-rw-r--r--pyramid/scaffolds/alchemy/+package+/tests.py_tmpl26
1 files changed, 24 insertions, 2 deletions
diff --git a/pyramid/scaffolds/alchemy/+package+/tests.py_tmpl b/pyramid/scaffolds/alchemy/+package+/tests.py_tmpl
index a26cd9eeb..e6425eb91 100644
--- a/pyramid/scaffolds/alchemy/+package+/tests.py_tmpl
+++ b/pyramid/scaffolds/alchemy/+package+/tests.py_tmpl
@@ -6,7 +6,7 @@ from pyramid import testing
from .models import DBSession
-class TestMyView(unittest.TestCase):
+class TestMyViewSuccessCondition(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
from sqlalchemy import create_engine
@@ -25,9 +25,31 @@ class TestMyView(unittest.TestCase):
DBSession.remove()
testing.tearDown()
- def test_it(self):
+ def test_passing_view(self):
from .views import my_view
request = testing.DummyRequest()
info = my_view(request)
self.assertEqual(info['one'].name, 'one')
self.assertEqual(info['project'], '{{project}}')
+
+
+class TestMyViewFailureCondition(unittest.TestCase):
+ def setUp(self):
+ self.config = testing.setUp()
+ from sqlalchemy import create_engine
+ engine = create_engine('sqlite://')
+ from .models import (
+ Base,
+ MyModel,
+ )
+ DBSession.configure(bind=engine)
+
+ def tearDown(self):
+ DBSession.remove()
+ testing.tearDown()
+
+ def test_failing_view(self):
+ from .views import my_view
+ request = testing.DummyRequest()
+ info = my_view(request)
+ self.assertEqual(info.status_int, 500) \ No newline at end of file