Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
webhooks/gitlab: Add fixture for MR opened with multiple assignees.
Hemanth V. Allurif57196b1d078
diff --git a/zerver/webhooks/gitlab/fixtures/merge_request_hook__merge_request_created_with_multiple_assignees.json b/zerver/webhooks/gitlab/fixtures/merge_request_hook__merge_request_created_with_multiple_assignees.jsonnew file mode 100644index 00000000000..98e026ae474--- /dev/null+++ b/zerver/webhooks/gitlab/fixtures/merge_request_hook__merge_request_created_with_multiple_assignees.json@@ -0,0 +1,188 @@+{+ "object_kind": "merge_request",+ "event_type": "merge_request",+ "user": {+ "name": "Hemanth V. Alluri",+ "username": "Hypro999",+ "avatar_url": "https://assets.gitlab-static.net/uploads/-/system/user/avatar/2222626/avatar.png",+ "email": "[email protected]"+ },+ "project": {+ "id": 20677423,+ "name": "Demo Project",+ "description": "Just a sample project for generating webhook fixtures.",+ "web_url": "https://gitlab.com/Hypro999/demo-project",+ "avatar_url": null,+ "git_ssh_url": "[email protected]:Hypro999/demo-project.git",+ "git_http_url": "https://gitlab.com/Hypro999/demo-project.git",+ "namespace": "Hemanth V. Alluri",+ "visibility_level": 20,+ "path_with_namespace": "Hypro999/demo-project",+ "default_branch": "master",+ "ci_config_path": "",+ "homepage": "https://gitlab.com/Hypro999/demo-project",+ "url": "[email protected]:Hypro999/demo-project.git",+ "ssh_url": "[email protected]:Hypro999/demo-project.git",+ "http_url": "https://gitlab.com/Hypro999/demo-project.git"+ },+ "object_attributes": {+ "assignee_id": 2222626,+ "author_id": 2222626,+ "created_at": "2020-08-22 09:35:19 UTC",+ "description": "A trivial change that should probably be ignored.",+ "head_pipeline_id": null,+ "id": 68400043,+ "iid": 1,+ "last_edited_at": null,+ "last_edited_by_id": null,+ "merge_commit_sha": null,+ "merge_error": null,+ "merge_params": {+ "force_remove_source_branch": "1"+ },+ "merge_status": "unchecked",+ "merge_user_id": null,+ "merge_when_pipeline_succeeds": false,+ "milestone_id": null,+ "source_branch": "devel",+ "source_project_id": 20677423,+ "state_id": 1,+ "target_branch": "master",+ "target_project_id": 20677423,+ "time_estimate": 0,+ "title": "Make a trivial change to the README.",+ "updated_at": "2020-08-22 09:35:19 UTC",+ "updated_by_id": null,+ "url": "https://gitlab.com/Hypro999/demo-project/-/merge_requests/1",+ "source": {+ "id": 20677423,+ "name": "Demo Project",+ "description": "Just a sample project for generating webhook fixtures.",+ "web_url": "https://gitlab.com/Hypro999/demo-project",+ "avatar_url": null,+ "git_ssh_url": "[email protected]:Hypro999/demo-project.git",+ "git_http_url": "https://gitlab.com/Hypro999/demo-project.git",+ "namespace": "Hemanth V. Alluri",+ "visibility_level": 20,+ "path_with_namespace": "Hypro999/demo-project",+ "default_branch": "master",+ "ci_config_path": "",+ "homepage": "https://gitlab.com/Hypro999/demo-project",+ "url": "[email protected]:Hypro999/demo-project.git",+ "ssh_url": "[email protected]:Hypro999/demo-project.git",+ "http_url": "https://gitlab.com/Hypro999/demo-project.git"+ },+ "target": {+ "id": 20677423,+ "name": "Demo Project",+ "description": "Just a sample project for generating webhook fixtures.",+ "web_url": "https://gitlab.com/Hypro999/demo-project",+ "avatar_url": null,+ "git_ssh_url": "[email protected]:Hypro999/demo-project.git",+ "git_http_url": "https://gitlab.com/Hypro999/demo-project.git",+ "namespace": "Hemanth V. Alluri",+ "visibility_level": 20,+ "path_with_namespace": "Hypro999/demo-project",+ "default_branch": "master",+ "ci_config_path": "",+ "homepage": "https://gitlab.com/Hypro999/demo-project",+ "url": "[email protected]:Hypro999/demo-project.git",+ "ssh_url": "[email protected]:Hypro999/demo-project.git",+ "http_url": "https://gitlab.com/Hypro999/demo-project.git"+ },+ "last_commit": {+ "id": "1499daa03599c6781f427ee683d2969f39cad4d0",+ "message": "Make a trivial change to the README.\n",+ "title": "Make a trivial change to the README.",+ "timestamp": "2020-08-22T14:21:01+05:30",+ "url": "https://gitlab.com/Hypro999/demo-project/-/commit/1499daa03599c6781f427ee683d2969f39cad4d0",+ "author": {+ "name": "Hemanth V. Alluri",+ "email": "[email protected]"+ }+ },+ "work_in_progress": false,+ "total_time_spent": 0,+ "human_total_time_spent": null,+ "human_time_estimate": null,+ "assignee_ids": [+ 2222626,+ 2808044+ ],+ "state": "opened",+ "action": "open"+ },+ "labels": [],+ "changes": {+ "author_id": {+ "previous": null,+ "current": 2222626+ },+ "created_at": {+ "previous": null,+ "current": "2020-08-22 09:35:19 UTC"+ },+ "description": {+ "previous": null,+ "current": "A trivial change that should probably be ignored."+ },+ "id": {+ "previous": null,+ "current": 68400043+ },+ "iid": {+ "previous": null,+ "current": 1+ },+ "merge_params": {+ "previous": {},+ "current": {+ "force_remove_source_branch": "1"+ }+ },+ "source_branch": {+ "previous": null,+ "current": "devel"+ },+ "source_project_id": {+ "previous": null,+ "current": 20677423+ },+ "target_branch": {+ "previous": null,+ "current": "master"+ },+ "target_project_id": {+ "previous": null,+ "current": 20677423+ },+ "title": {+ "previous": null,+ "current": "Make a trivial change to the README."+ },+ "updated_at": {+ "previous": null,+ "current": "2020-08-22 09:35:19 UTC"+ }+ },+ "repository": {+ "name": "Demo Project",+ "url": "[email protected]:Hypro999/demo-project.git",+ "description": "Just a sample project for generating webhook fixtures.",+ "homepage": "https://gitlab.com/Hypro999/demo-project"+ },+ "assignees": [+ {+ "name": "Hemanth V. Alluri",+ "username": "Hypro999",+ "avatar_url": "https://assets.gitlab-static.net/uploads/-/system/user/avatar/2222626/avatar.png",+ "email": "[email protected]"+ },+ {+ "name": "Hemanth V. Alluri",+ "username": "f20171170",+ "avatar_url": "https://assets.gitlab-static.net/uploads/-/system/user/avatar/2808044/avatar.png",+ "email": "[email protected]"+ }+ ]+}diff --git a/zerver/webhooks/gitlab/tests.py b/zerver/webhooks/gitlab/tests.pyindex 575517ae84e..c1e689f3a62 100644--- a/zerver/webhooks/gitlab/tests.py+++ b/zerver/webhooks/gitlab/tests.py@@ -311,6 +311,20 @@ class GitlabHookTests(WebhookTestCase):expected_message,)+ def test_merge_request_created_with_multiple_assignees_event_message(self) -> None:+ expected_topic = "Demo Project / MR #1 Make a trivial change to the README."+ expected_message = """+Hemanth V. Alluri created [MR #1](https://gitlab.com/Hypro999/demo-project/-/merge_requests/1) (assigned to Hemanth V. Alluri and Hemanth V. Alluri) from `devel` to `master`:++~~~ quote+A trivial change that should probably be ignored.+~~~+ """.strip()+ self.check_webhook(+ 'merge_request_hook__merge_request_created_with_multiple_assignees',+ expected_topic,+ expected_message)+def test_merge_request_closed_event_message(self) -> None:expected_topic = "my-awesome-project / MR #2 NEW MR"expected_message = "Tomasz Kolek closed [MR #2](https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/2)."