Anything can be None in GitLab!

Fixes a problem where the `project_access` block is reported as `null` from GitLab API, which breaks our code, because we assume sanity in API design.
This commit is contained in:
Joseph Schorr 2017-05-01 20:00:52 -04:00
parent a3955d9705
commit ae7012eef2
2 changed files with 26 additions and 14 deletions

View file

@ -27,6 +27,13 @@ def get_currentuser_mock():
}
def project(namespace, name, is_org=False):
project_access = None
if namespace == 'knownuser':
project_access = {
'access_level': 50,
}
data = {
'id': '%s/%s' % (namespace, name),
'default_branch': 'master',
@ -43,9 +50,7 @@ def project(namespace, name, is_org=False):
'ssh_url_to_repo': 'git://%s/%s' % (namespace, name),
'public': name != 'somerepo',
'permissions': {
'project_access': {
'access_level': 50 if namespace == 'knownuser' else 0,
}
'project_access': project_access,
},
'owner': {
'avatar_url': 'avatarurl',