From 903ff126b0209c5726705cb72cd0986561ee22f5 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 19 Jun 2009 00:29:18 +0000 Subject: [PATCH] [soc2009/multidb] Added tests to ensure that objects aren't being created before they are supposed to be, which would indicate we weren't creating objects in the right DB. git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/multidb@11076 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/multiple_database/tests.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/regressiontests/multiple_database/tests.py b/tests/regressiontests/multiple_database/tests.py index f38ddda490..0cd1253780 100644 --- a/tests/regressiontests/multiple_database/tests.py +++ b/tests/regressiontests/multiple_database/tests.py @@ -28,6 +28,8 @@ class ConnectionHandlerTestCase(TestCase): class QueryTestCase(TestCase): def test_basic_queries(self): for db in connections: + self.assertRaises(Book.DoesNotExist, + lambda: Book.objects.using(db).get(title="Dive into Python")) Book.objects.using(db).create(title="Dive into Python", published=datetime.date(2009, 5, 4)) @@ -39,6 +41,8 @@ class QueryTestCase(TestCase): self.assertEqual(books[0].published, datetime.date(2009, 5, 4)) for db in connections: + self.assertRaises(Book.DoesNotExist, + lambda: Book.objects.using(db).get(title="Pro Django")) book = Book(title="Pro Django", published=datetime.date(2008, 12, 16)) book.save(using=db)