Ejemplo n.º 1
0
 def test_delete_registration_type_error(self):
     with self.app.test_request_context():
         with patch.object(Interactions, 'delete_specific',
                           side_effect=TypeError):
             response = delete_registration('123')
             self.assertRaises(TypeError)
             self.assertEqual(response.status_code,
                              client.BAD_REQUEST)
Ejemplo n.º 2
0
 def test_delete_registration_rql_driver_error(self):
     with self.app.test_request_context():
         with patch.object(Interactions, 'delete_specific',
                           side_effect=RqlDriverError(None)):
             response = delete_registration('123')
             self.assertRaises(RqlDriverError)
             self.assertEqual(response.status_code,
                              client.INTERNAL_SERVER_ERROR)
Ejemplo n.º 3
0
    def delete(self, registration_id):
        """
        Deletes registration record, will also remove the records for this
        registration_id in the subscription table as well
        """
        return_val = validate_access(request.headers['username'],
                                     registration_id=registration_id)

        if return_val:
            return return_val

        return delete_registration(registration_id)
Ejemplo n.º 4
0
    def delete(self, registration_id):
        """
        Deletes registration record, will also remove the records for this
        registration_id in the subscription table as well
        """
        return_val = validate_access(
            request.headers['username'],
            registration_id=registration_id)

        if return_val:
            return return_val

        return delete_registration(registration_id)
 def test_delete_registration_rql_runtime_error(self):
     with self.app.test_request_context():
         with patch.object(Interactions, "delete_specific", side_effect=RqlRuntimeError(None, None, None)):
             response = delete_registration("123")
             self.assertRaises(RqlRuntimeError)
             self.assertEqual(response.status_code, client.INTERNAL_SERVER_ERROR)
 def test_delete_registration(self):
     with self.app.test_request_context():
         with patch.object(Interactions, "delete_specific", return_value={}):
             response = delete_registration("123")
             self.assertEqual(response.status_code, client.OK)
Ejemplo n.º 7
0
 def test_delete_registration(self):
     with self.app.test_request_context():
         with patch.object(Interactions, 'delete_specific',
                           return_value={}):
             response = delete_registration('123')
             self.assertEqual(response.status_code, client.OK)