From 3e9e13104e599deed07d6946062bb3ea3df4a079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Thu, 26 Aug 2021 14:57:34 +0300 Subject: [PATCH] Remove unused code --- hc/api/models.py | 12 ------------ hc/api/tests/test_channel_model.py | 5 ----- 2 files changed, 17 deletions(-) diff --git a/hc/api/models.py b/hc/api/models.py index bc756280..243264a2 100644 --- a/hc/api/models.py +++ b/hc/api/models.py @@ -650,12 +650,6 @@ class Channel(models.Model): return self.json["service_key"] - @property - def pd_service_name(self): - assert self.kind == "pd" - if self.value.startswith("{"): - return self.json.get("name") - @property def pd_account(self): assert self.kind == "pd" @@ -733,17 +727,11 @@ class Channel(models.Model): @property def sms_notify_up(self): assert self.kind == "sms" - if not self.value.startswith("{"): - return False - return self.json.get("up", False) @property def sms_notify_down(self): assert self.kind == "sms" - if not self.value.startswith("{"): - return True - return self.json.get("down", True) @property diff --git a/hc/api/tests/test_channel_model.py b/hc/api/tests/test_channel_model.py index ab3f9e61..3c900fcc 100644 --- a/hc/api/tests/test_channel_model.py +++ b/hc/api/tests/test_channel_model.py @@ -51,11 +51,6 @@ class ChannelModelTestCase(BaseTestCase): self.assertEqual(c.opsgenie_key, "abc") self.assertEqual(c.opsgenie_region, "eu") - def test_it_handles_legacy_sms_value(self): - c = Channel(kind="sms", value="+123123123") - self.assertTrue(c.sms_notify_down) - self.assertFalse(c.sms_notify_up) - def test_it_handles_legacy_sms_json_value(self): c = Channel(kind="sms", value=json.dumps({"value": "+123123123"})) self.assertTrue(c.sms_notify_down)