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)
    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_connect_other_error(self):
     # Only operational errors should be catched
     with self.assertRaises(MockException):
         connect()
    def test_connect_error(self):
        # Operation errors should be catched
        result = connect()

        self.assertEqual(result, False)
        self.assertEqual(is_connected(), False)
Exemple #5
0
        'queue': PROGRESS_QUEUE,
        'handler': on_workflow_progress
    },
    'start_tasks': {
        'queue': TASK_QUEUE,
        'handler': task_queue.on_start_tasks,
    },
    'task_completed': {
        'queue': TASK_RESULT_QUEUE,
        'handler': task_queue.on_task_result
    },
}

parser = argparse.ArgumentParser(prog="python -m gobworkflow",
                                 description="GOB Workflow manager")

parser.add_argument('--migrate',
                    action='store_true',
                    default=False,
                    help='migrate the management database')
args = parser.parse_args()

if args.migrate:
    print("Storage migration forced")
    connect(force_migrate=True)
else:
    connect()

    params = {"prefetch_count": 1, "load_message": False}
    messagedriven_service(SERVICEDEFINITION, "Workflow", params)
def run_e2e_tests():
    if __name__ == "__main__":
        connect()
        e2e = E2ETest()
        error_cnt = e2e.run()
        exit(error_cnt)
Exemple #7
0
def init():
    if __name__ == '__main__':
        connect()
        WorkflowCommands()