def test_request_finished_db_state(self): # Make sure there is an open connection connection.cursor() connection.enter_transaction_management() connection.managed(True) signals.request_finished.send(sender=self.__class__) # In-memory sqlite doesn't actually close connections. if connection.vendor != 'sqlite': self.assertIs(connection.connection, None) self.assertEqual(len(connection.transaction_state), 0)
def test_request_finished_db_state(self): # The GET below will not succeed, but it will give a response with # defined ._handler_class. That is needed for sending the # request_finished signal. response = self.client.get('/') # Make sure there is an open connection connection.cursor() connection.enter_transaction_management() connection.managed(True) signals.request_finished.send(sender=response._handler_class) # In-memory sqlite doesn't actually close connections. if connection.vendor != 'sqlite': self.assertIs(connection.connection, None) self.assertEqual(len(connection.transaction_state), 0)