From c2e923543a98369d3839780967d1e96fbeb2b008 Mon Sep 17 00:00:00 2001 From: Rudi Giesler Date: Thu, 21 Aug 2014 15:35:22 +0200 Subject: [PATCH] Added delete group and tests --- go_http/contacts.py | 9 +++++++++ go_http/tests/test_contacts.py | 15 +++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/go_http/contacts.py b/go_http/contacts.py index 901136d..5736ed4 100644 --- a/go_http/contacts.py +++ b/go_http/contacts.py @@ -117,3 +117,12 @@ def update_group(self, group_key, update_data): Fields to modify. """ return self._api_request("PUT", "groups", group_key, update_data) + + def delete_group(self, group_key): + """ + Delete a group. + + :param str group_key + Key for the group to delete. + """ + return self._api_request("DELETE", "groups", group_key) diff --git a/go_http/tests/test_contacts.py b/go_http/tests/test_contacts.py index f1b4821..dbfc2c6 100644 --- a/go_http/tests/test_contacts.py +++ b/go_http/tests/test_contacts.py @@ -352,3 +352,18 @@ def test_update_smart_group(self): def test_update_missing_group(self): client = self.make_client() self.assert_http_error(404, client.update_group, 'foo', {}) + + def test_delete_group(self): + client = self.make_client() + existing_group = self.make_existing_group({ + u'name': u'Bob' + }) + + self.assert_group_status(existing_group[u'key'], exists=True) + group = client.delete_group(existing_group[u'key']) + self.assertEqual(existing_group, group) + self.assert_group_status(group[u'key'], exists=False) + + def test_delete_missing_group(self): + client = self.make_client() + self.assert_http_error(404, client.delete_group, 'foo')