--- a/test.py Mon Jul 25 16:24:07 2016 +0800
+++ b/test.py Mon Jul 25 16:42:36 2016 +0800
+ def json_payload(self, data):
+ return {'content_type': 'application/json', 'data': json.dumps(data)}
def create_resource(self, new_resource):
url = self.list_url % self.workspace
- response = self.c.post(url, content_type='application/json', data=json.dumps(new_resource))
+ response = self.c.post(url, **self.json_payload(new_resource))
data = json.loads(response.data)
self.assertIn('_t', data)
def update_resource(self, resource_id, resource_update):
url = self.item_url % (self.workspace, resource_id)
- response = self.c.put(url, content_type='application/json', data=json.dumps(resource_update))
+ response = self.c.put(url, **self.json_payload(resource_update))
data = json.loads(response.data)
self.assertEqual(data['_id'], resource_id)