def test_client_delete_unk_error(self): """Test the client response to an unknown error.""" endpoint_url = 'http://127.0.0.1:8080' class_type = 'users' params = { '_id': 127 } httpretty.register_uri(httpretty.DELETE, '{0}/{1}'.format(endpoint_url, class_type), body='This is the error.', status=301) client = PMClient(endpoint_url) try: client.delete(class_type, params) except PMClientError as ex: self.assertEqual(str(ex), 'Unknown Error (301) This is the error.')
def test_client_delete_unk_error(self): """ Test the client response to an unknown error """ endpoint_url = "http://127.0.0.1:8080" class_type = "users" params = { "_id": 127 } httpretty.register_uri(httpretty.DELETE, "%s/%s"%(endpoint_url, class_type), body="This is the error.", status=301) client = PMClient(endpoint_url) try: client.delete(class_type, params) except PMClientError, ex: self.assertEqual(str(ex), "Unknown Error (301) This is the error.")
def test_client_delete_notfound(self): """Test the client response to an unknown error.""" endpoint_url = 'http://127.0.0.1:8080' class_type = 'users' params = { '_id': 127 } httpretty.register_uri(httpretty.DELETE, '{0}/{1}'.format(endpoint_url, class_type), status=404) client = PMClient(endpoint_url) response = client.delete(class_type, params) self.assertTrue(response)
def test_client_delete(self): """ Test the client response to an unknown error """ endpoint_url = "http://127.0.0.1:8080" class_type = "users" params = { "_id": 127 } httpretty.register_uri(httpretty.DELETE, "%s/%s"%(endpoint_url, class_type)) client = PMClient(endpoint_url) response = client.delete(class_type, params) self.assertTrue(response)