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

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