Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 26 lines (16 sloc) 0.592 kb
7eb4827 @carljm More stuff.
authored
1 <!SLIDE incremental>
2
3 # Imposing no-DB discipline. #
4
5 * For certain test cases.
6
7 <!SLIDE>
8
9 @@@ python
10 from django.utils.unittest import TestCase
11
12 import mock
13
14 cursor_wrapper = mock.Mock()
15 cursor_wrapper.side_effect = \
16 RuntimeError("No touching the database!")
17
18
19 @mock.patch(
20 "django.db.backends.util.CursorWrapper",
21 cursor_wrapper)
22 class NoDBTestCase(TestCase):
23 """Will blow up if you database."""
24
25 .notes django.utils.unittest.TestCase vs django.test.TestCase. Latter's assertions mostly useful with the DB, but either way works.
Something went wrong with that request. Please try again.