Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
webhooks/gitlab: Remove redundant Feature Flag Hook fixture.
Niloth P525c595ccfbb
diff --git a/zerver/webhooks/gitlab/fixtures/feature_flag_hook__activated.json b/zerver/webhooks/gitlab/fixtures/feature_flag_hook.jsonsimilarity index 100%rename from zerver/webhooks/gitlab/fixtures/feature_flag_hook__activated.jsonrename to zerver/webhooks/gitlab/fixtures/feature_flag_hook.jsondiff --git a/zerver/webhooks/gitlab/fixtures/feature_flag_hook__deactivated.json b/zerver/webhooks/gitlab/fixtures/feature_flag_hook__deactivated.jsondeleted file mode 100644index 0aee4cbc1e2..00000000000--- a/zerver/webhooks/gitlab/fixtures/feature_flag_hook__deactivated.json+++ /dev/null@@ -1,35 +0,0 @@-{- "object_kind": "feature_flag",- "project": {- "id": 68452408,- "name": "sample",- "description": null,- "web_url": "https://gitlab.com/kolanuvarun/sample",- "avatar_url": null,- "git_ssh_url": "[email protected]:kolanuvarun/sample.git",- "git_http_url": "https://gitlab.com/kolanuvarun/sample.git",- "namespace": "kolanuvarun",- "visibility_level": 0,- "path_with_namespace": "kolanuvarun/sample",- "default_branch": "master",- "ci_config_path": "",- "homepage": "https://gitlab.com/kolanuvarun/sample",- "url": "[email protected]:kolanuvarun/sample.git",- "ssh_url": "[email protected]:kolanuvarun/sample.git",- "http_url": "https://gitlab.com/kolanuvarun/sample.git"- },- "user": {- "id": 26076637,- "name": "Varun Kolanu",- "username": "kolanuvarun739",- "avatar_url": "https://secure.gravatar.com/avatar/dde05c11435528ac083e918ce384c5b943c7ec54be520b7f4a4bcd3863b36060?s=80&d=identicon",- "email": "[REDACTED]"- },- "user_url": "https://gitlab.com/kolanuvarun739",- "object_attributes": {- "id": 2073324,- "name": "sample-feature-flag",- "description": "",- "active": false- }-}diff --git a/zerver/webhooks/gitlab/tests.py b/zerver/webhooks/gitlab/tests.pyindex 030a1080e4f..c419bf9b232 100644--- a/zerver/webhooks/gitlab/tests.py+++ b/zerver/webhooks/gitlab/tests.py@@ -662,17 +662,27 @@ A trivial change that should probably be ignored.self.check_webhook("release_hook", expected_topic_name, expected_message)- def test_feature_flag_activate_event_message(self) -> None:+ def test_feature_flag_event_messages(self) -> None:+ feature_flag_link = (+ "[sample-feature-flag](https://gitlab.com/kolanuvarun/sample/-/feature_flags)"+ )expected_topic_name = "sample"- expected_message = "Varun Kolanu activated the feature flag [sample-feature-flag](https://gitlab.com/kolanuvarun/sample/-/feature_flags)."-- self.check_webhook("feature_flag_hook__activated", expected_topic_name, expected_message)+ test_cases = [+ (True, f"Varun Kolanu activated the feature flag {feature_flag_link}."),+ (False, f"Varun Kolanu deactivated the feature flag {feature_flag_link}."),+ ]- def test_feature_flag_deactivate_event_message(self) -> None:- expected_topic_name = "sample"- expected_message = "Varun Kolanu deactivated the feature flag [sample-feature-flag](https://gitlab.com/kolanuvarun/sample/-/feature_flags)."+ payload = orjson.loads(self.get_body("feature_flag_hook"))- self.check_webhook("feature_flag_hook__deactivated", expected_topic_name, expected_message)+ for active, expected_message in test_cases:+ with self.subTest(active=active):+ payload["object_attributes"]["active"] = active+ self.check_webhook(+ "feature_flag_hook",+ expected_topic_name,+ expected_message,+ custom_payload=payload,+ )def test_resource_access_token_project_expiry(self) -> None:expected_topic_name = "Flight"