def test_task_register_delete(test_app):

    cassette_exists = os.path.isfile(
        os.path.join(os.path.dirname(os.path.abspath(__file__)), 'vcr_cassettes', 'task_service.yaml')
    )

    with test_app() as app:

        if cassette_exists:
            # Use mock session, so CI doesn't fail (creds)
            test_auth = get_mock_gbdx_session()
            task_service = TaskService(auth=test_auth)
        else:
            # Create real session
            task_service = TaskService()

        message = task_service.register_task(app.task.json())
        print(message)
        assert 'not registered' not in message

        message = task_service.delete_task(app.task.name)
        print(message)
        assert 'not deleted' not in message
Example #2
0
def mock_auth():
    return get_mock_gbdx_session()