Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added more precise assertions on two fixture tests.

  • Loading branch information...
commit 6492e8e5e6643c5a90d71727af7f17a362b9362b 1 parent 10a9c26
Claude Paroz authored June 07, 2012

Showing 1 changed file with 6 additions and 10 deletions. Show diff stats Hide diff stats

  1. 16  tests/modeltests/fixtures/tests.py
16  tests/modeltests/fixtures/tests.py
@@ -185,18 +185,14 @@ def test_dumpdata_with_excludes(self):
185 185
             exclude_list=['fixtures.Article', 'fixtures.Book', 'sites'])
186 186
 
187 187
         # Excluding a bogus app should throw an error
188  
-        self.assertRaises(management.CommandError,
189  
-                          self._dumpdata_assert,
190  
-                          ['fixtures', 'sites'],
191  
-                          '',
192  
-                          exclude_list=['foo_app'])
  188
+        with self.assertRaisesRegexp(management.CommandError,
  189
+                "Unknown app in excludes: foo_app"):
  190
+            self._dumpdata_assert(['fixtures', 'sites'], '', exclude_list=['foo_app'])
193 191
 
194 192
         # Excluding a bogus model should throw an error
195  
-        self.assertRaises(management.CommandError,
196  
-                          self._dumpdata_assert,
197  
-                          ['fixtures', 'sites'],
198  
-                          '',
199  
-                          exclude_list=['fixtures.FooModel'])
  193
+        with self.assertRaisesRegexp(management.CommandError,
  194
+                "Unknown model in excludes: fixtures.FooModel"):
  195
+            self._dumpdata_assert(['fixtures', 'sites'], '', exclude_list=['fixtures.FooModel'])
200 196
 
201 197
     def test_dumpdata_with_filtering_manager(self):
202 198
         spy1 = Spy.objects.create(name='Paul')

0 notes on commit 6492e8e

Please sign in to comment.
Something went wrong with that request. Please try again.