def setUp(self): try: HookTest.setUp(self) except self.Error: self.assertHooks(['beforeSetUp', '_setup', 'afterClear']) # Connection has been closed self.assertEqual(connections.count(), 0)
def tearDown(self): self._called = [] try: HookTest.tearDown(self) except self.Error: self.assertHooks(['beforeTearDown', 'beforeClose', 'afterClear']) # Connection has been closed self.assertEqual(connections.count(), 0)
def testClearClosesConnection(self): self.assertEqual(connections.count(), 1) self._clear() self.assertEqual(connections.count(), 0)
def testAppOpensConnection(self): self.assertEqual(connections.count(), 1) self._app() self.assertEqual(connections.count(), 2)
def testCloseClosesAllConnections(self): self._app() self.assertEqual(connections.count(), 2) self._close() self.assertEqual(connections.count(), 0)
def testCloseClosesConnection(self): self.assertEqual(connections.count(), 1) self._close() self.assertEqual(connections.count(), 0)