def test_delete_fail(self):
        client = Client(self.api_url)
        pattern_manager = PatternManager(client)

        pattern_id = '1'

        with patch.object(client, 'delete') as delete_mock:
            res = pattern_manager.delete(pattern_id)

        self.assertTrue(delete_mock.called)
        self.assertFalse(res)
        delete_mock.assert_called_with('pattern/' + pattern_id)
    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)