示例#1
0
    def test_delete(self):
        client = Client(self.api_url)
        contact_manager = ContactManager(client)

        contact_id = '1'

        with patch.object(client, 'delete', new=Mock(side_effect=InvalidJSONError(b''))) as delete_mock:
            res = contact_manager.delete(contact_id)

        self.assertTrue(delete_mock.called)
        self.assertTrue(res)
        delete_mock.assert_called_with('contact/' + contact_id)
示例#2
0
    def test_delete_all(self):
        client = Client(self.api_url)
        notification_manager = NotificationManager(client)

        with patch.object(
                client, 'delete',
                new=Mock(side_effect=InvalidJSONError(b''))) as delete_mock:
            res = notification_manager.delete_all()

        self.assertTrue(delete_mock.called)
        self.assertTrue(res)
        delete_mock.assert_called_with('notification/all')
示例#3
0
    def test_test(self):
        client = Client(self.api_url)
        subscription_manager = SubscriptionManager(client)

        subscription_id = '1'

        with patch.object(client, 'put', new=Mock(side_effect=InvalidJSONError(b''))) as put_mock:
            res = subscription_manager.test(subscription_id)

        self.assertTrue(put_mock.called)
        self.assertTrue(res)
        put_mock.assert_called_with('subscription/' + subscription_id + '/test')
示例#4
0
    def test_delete(self):
        client = Client(self.api_url)
        subscription_manager = SubscriptionManager(client)

        subscription_id = '1'

        with patch.object(client, 'delete', new=Mock(side_effect=InvalidJSONError(b''))) as delete_mock:
            res = subscription_manager.delete(subscription_id)

        self.assertTrue(delete_mock.called)
        self.assertTrue(res)
        delete_mock.assert_called_with('subscription/' + subscription_id)
示例#5
0
    def test_delete(self):
        client = Client(self.api_url)
        pattern_manager = PatternManager(client)

        pattern_id = '1'

        with patch.object(
                client, 'delete',
                new=Mock(side_effect=InvalidJSONError(b''))) as delete_mock:
            res = pattern_manager.delete(pattern_id)

        self.assertTrue(delete_mock.called)
        self.assertTrue(res)
        delete_mock.assert_called_with('pattern/' + pattern_id)
示例#6
0
    def test_delete_fail(self):
        client = Client(self.api_url)
        tag_manager = TagManager(client)

        tag = 'tag'

        with patch.object(
                client, 'delete',
                new=Mock(side_effect=InvalidJSONError(b''))) as delete_mock:
            res = tag_manager.delete(tag)

        self.assertTrue(delete_mock.called)
        self.assertFalse(res)
        delete_mock.assert_called_with('tag/' + tag)
示例#7
0
    def test_delete(self):
        client = Client(self.api_url)
        trigger_manager = TriggerManager(client)

        trigger_id = '1'

        with patch.object(
                client, 'delete',
                new=Mock(side_effect=InvalidJSONError(b''))) as delete_mock:
            res = trigger_manager.delete(trigger_id)

        self.assertTrue(delete_mock.called)
        self.assertTrue(res)
        delete_mock.assert_called_with('trigger/' + trigger_id)