def test_connect(self, mock_create, mock_migrate):
        result = connect()

        mock_create.assert_called()
        mock_migrate.assert_called()
        self.assertEqual(result, True)
        self.assertEqual(is_connected(), True)
Beispiel #2
0
    def test_connect(self, mock_create, mock_migrate, mock_url):
        result = connect()

        mock_create.assert_called_with(mock_url.create.return_value, connect_args={'sslmode': 'require'})
        mock_migrate.assert_called()
        self.assertEqual(result, True)
        self.assertEqual(is_connected(), True)
    def test_disconnect(self, mock_rollback, mock_close, mock_dispose):

        disconnect()

        mock_rollback.assert_called()
        mock_close.assert_called()
        mock_dispose.assert_called()

        self.assertEqual(gobworkflow.storage.storage.session, None)
        self.assertEqual(gobworkflow.storage.storage.engine, None)
        self.assertEqual(is_connected(), False)
 def test_is_connected_ok(self):
     result = is_connected()
     self.assertEqual(result, True)
 def test_is_connected_not_ok(self):
     result = is_connected()
     self.assertEqual(result, False)
    def test_connect_error(self):
        # Operation errors should be catched
        result = connect()

        self.assertEqual(result, False)
        self.assertEqual(is_connected(), False)