def test_delete_type_error(self):
     with self.app.test_request_context():
         with patch.object(Interactions, 'delete',
                           side_effect=TypeError):
             response = delete(DEFAULT_SUBSCRIPTIONS_TABLE, '123')
             self.assertRaises(TypeError)
             self.assertEqual(response.status_code,
                              client.BAD_REQUEST)
 def test_delete_rql_driver_error(self):
     with self.app.test_request_context():
         with patch.object(Interactions, 'delete',
                           side_effect=RqlDriverError(None)):
             response = delete(DEFAULT_SUBSCRIPTIONS_TABLE, '123')
             self.assertRaises(RqlDriverError)
             self.assertEqual(response.status_code,
                              client.INTERNAL_SERVER_ERROR)
예제 #3
0
    def delete(self, subscription_id):
        """
        Deletes subscription record
        """
        return_val = validate_access(request.headers['username'],
                                     subscription_id=subscription_id)

        if return_val:
            return return_val

        return delete(DEFAULT_SUBSCRIPTIONS_TABLE, subscription_id)
예제 #4
0
    def delete(self, subscription_id):
        """
        Deletes subscription record
        """
        return_val = validate_access(
            request.headers['username'],
            subscription_id=subscription_id)

        if return_val:
            return return_val

        return delete(DEFAULT_SUBSCRIPTIONS_TABLE, subscription_id)
 def test_delete_rql_runtime_error(self):
     with self.app.test_request_context():
         with patch.object(Interactions, "delete", side_effect=RqlRuntimeError(None, None, None)):
             response = delete(DEFAULT_SUBSCRIPTIONS_TABLE, "123")
             self.assertRaises(RqlRuntimeError)
             self.assertEqual(response.status_code, client.INTERNAL_SERVER_ERROR)
 def test_delete(self):
     with self.app.test_request_context():
         with patch.object(Interactions, "delete", return_value={}):
             response = delete(DEFAULT_SUBSCRIPTIONS_TABLE, "123")
             self.assertEqual(response.status_code, client.OK)
 def test_delete(self):
     with self.app.test_request_context():
         with patch.object(Interactions, 'delete',
                           return_value={}):
             response = delete(DEFAULT_SUBSCRIPTIONS_TABLE, '123')
             self.assertEqual(response.status_code, client.OK)