def api_mock(gitlab_url, auth_token): assert gitlab_url == 'http://foo.com' assert auth_token in ('NON-ADMIN-TOKEN', 'ADMIN-TOKEN') api = gitlab_mock.Api(gitlab_url=gitlab_url, auth_token=auth_token, initial_state='initial') user_info_for_token = dict(user_info, is_admin=auth_token == 'ADMIN-TOKEN') api.add_user(user_info_for_token, is_current=True) return api
def api_mock(gitlab_url, auth_token): assert gitlab_url == 'http://foo.com' assert auth_token in ('NON-ADMIN-TOKEN', 'ADMIN-TOKEN') api = gitlab_mock.Api(gitlab_url=gitlab_url, auth_token=auth_token, initial_state='initial') user_info_for_token = dict(user_info, is_admin=auth_token == 'ADMIN-TOKEN') api.add_user(user_info_for_token, is_current=True) api.add_transition(gitlab_mock.GET('/version'), gitlab_mock.Ok({'version': '11.6.0-ce'})) return api