Exemplo n.º 1
0
    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)
Exemplo n.º 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)
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
 def test_is_connected_ok(self):
     result = is_connected()
     self.assertEqual(result, True)
Exemplo n.º 5
0
 def test_is_connected_not_ok(self):
     result = is_connected()
     self.assertEqual(result, False)
Exemplo n.º 6
0
    def test_connect_error(self):
        # Operation errors should be catched
        result = connect()

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