Gitlab can return None
for avatar blocks
Because reasons!
This commit is contained in:
parent
cc88cfb6ad
commit
69ff58f7bd
3 changed files with 70 additions and 32 deletions
|
@ -1,7 +1,9 @@
|
|||
import json
|
||||
import pytest
|
||||
|
||||
from buildtrigger.test.gitlabmock import get_gitlab_trigger
|
||||
from mock import Mock
|
||||
|
||||
from buildtrigger.test.gitlabmock import get_gitlab_trigger, get_mock_gitlab
|
||||
from buildtrigger.triggerutil import (SkipRequestException, ValidationRequestException,
|
||||
InvalidPayloadException)
|
||||
from endpoints.building import PreparedBuild
|
||||
|
@ -35,6 +37,21 @@ def test_lookup_user(email, expected_response, gitlab_trigger):
|
|||
assert gitlab_trigger.lookup_user(email) == expected_response
|
||||
|
||||
|
||||
def test_null_avatar(gitlab_trigger):
|
||||
gitlab_trigger._get_authorized_client = get_mock_gitlab(with_nullavatar=True)
|
||||
namespace_data = gitlab_trigger.list_build_source_namespaces()
|
||||
expected = {
|
||||
'avatar_url': None,
|
||||
'personal': False,
|
||||
'title': 'someorg',
|
||||
'url': 'https://bitbucket.org/someorg',
|
||||
'score': 1,
|
||||
'id': 'someorg',
|
||||
}
|
||||
|
||||
assert namespace_data == [expected]
|
||||
|
||||
|
||||
@pytest.mark.parametrize('payload, expected_error, expected_message', [
|
||||
('{}', InvalidPayloadException, ''),
|
||||
|
||||
|
|
Reference in a new issue