diff --git a/perceval/backends/core/gitlab.py b/perceval/backends/core/gitlab.py index 156a4c1c1..19e38ea48 100644 --- a/perceval/backends/core/gitlab.py +++ b/perceval/backends/core/gitlab.py @@ -81,7 +81,7 @@ class GitLab(Backend): :param sleep_time: time to sleep in case :param blacklist_ids: ids of items that must not be retrieved """ - version = '0.7.0' + version = '0.7.1' CATEGORIES = [CATEGORY_ISSUE, CATEGORY_MERGE_REQUEST] @@ -350,7 +350,7 @@ def __get_note_award_emoji(self, item_type, item_id, note_id): emojis.append(emoji) except requests.exceptions.HTTPError as error: if error.response.status_code == 404: - logger.warning("Emojis not available for %s ", + logger.warning("Emojis not available for %s", urijoin(item_type, str(item_id), GitLabClient.NOTES, str(note_id), GitLabClient.EMOJI)) return emojis diff --git a/tests/test_gitlab.py b/tests/test_gitlab.py index 1569498cf..5e57dae25 100644 --- a/tests/test_gitlab.py +++ b/tests/test_gitlab.py @@ -64,7 +64,9 @@ GITLAB_ENTERPRISE_MERGES_URL = GITLAB_ENTERPRISE_API_URL + "/projects/am%2Ftest/merge_requests" -def setup_http_server(url_project, issues_url, merges_url, user_url, rate_limit_headers=None): +def setup_http_server(url_project, issues_url, merges_url, user_url, + rate_limit_headers=None, no_id_user=False, + emojis_http_error=False): project = read_file('data/gitlab/project') page_issues_1 = read_file('data/gitlab/issue_page_1') page_issues_2 = read_file('data/gitlab/issue_page_2') @@ -121,7 +123,11 @@ def setup_http_server(url_project, issues_url, merges_url, user_url, rate_limit_ notes_1 = read_file('data/gitlab/notes_1') notes_2 = read_file('data/gitlab/notes_2') notes_3 = read_file('data/gitlab/notes_3') - notes_4 = read_file('data/gitlab/notes_4') + + if no_id_user: + notes_4 = read_file('data/gitlab/notes_4_no_id_user') + else: + notes_4 = read_file('data/gitlab/notes_4') # issue notes httpretty.register_uri(httpretty.GET, @@ -271,11 +277,18 @@ def setup_http_server(url_project, issues_url, merges_url, user_url, rate_limit_ status=200, forcing_headers=rate_limit_headers) - httpretty.register_uri(httpretty.GET, - issues_url + "/1/notes/1/award_emoji", - body=emoji, - status=200, - forcing_headers=rate_limit_headers) + if emojis_http_error: + httpretty.register_uri(httpretty.GET, + issues_url + "/1/notes/1/award_emoji", + body=emoji, + status=404, + forcing_headers=rate_limit_headers) + else: + httpretty.register_uri(httpretty.GET, + issues_url + "/1/notes/1/award_emoji", + body=emoji, + status=200, + forcing_headers=rate_limit_headers) httpretty.register_uri(httpretty.GET, issues_url + "/1/notes/2/award_emoji",