def wrapper(self): payload = '{"i": {"a": "hello"}, "d": {"x": null}, "l": ["m", "n"]}' response = self.client.post('/complexdoc/', data=payload, content_type='application/json') json_data = response.get_json() self.url = '/complexdoc/%s' % json_data[config.ID_FIELD] response = self.client.get(self.url).get_json() self.etag = response[config.ETAG] self._id = response[config.ID_FIELD] self.updated = response[config.LAST_UPDATED] f(self) ComplexDoc.objects().delete()
def wrapper(self): payload = '{"i": {"a": "hello"}, "d": {"x": null}, "l": ["m", "n"], '+\ '"o": [{"a":"hi"},{"b":9}], "p": [{"ll": ["q", "w"]}]}' response = self.client.post('/complexdoc/', data=payload, content_type='application/json') json_data = response.get_json() self._id = json_data[config.ID_FIELD] self.url = '/complexdoc/%s' % json_data[config.ID_FIELD] self.etag = json_data[config.ETAG] # check if etags are okay self.assertEqual(self.client.get(self.url).get_json()[config.ETAG], self.etag) #self._id = response[config.ID_FIELD] self.updated = json_data[config.LAST_UPDATED] try: f(self) finally: ComplexDoc.objects().delete()
def wrapper(self): payload = '{"i": {"a": "hello"}, "d": {"x": null}, "l": ["m", "n"], '+\ '"o": [{"a":"hi"},{"b":9}], "p": [{"ll": ["q", "w"]}]}' response = self.client.post('/complexdoc/', data=payload, content_type='application/json') json_data = response.get_json() self._id = json_data[config.ID_FIELD] self.url = '/complexdoc/%s' % json_data[config.ID_FIELD] self.etag = json_data[config.ETAG] # check if etags are okay self.assertEqual( self.client.get(self.url).get_json()[config.ETAG], self.etag) #self._id = response[config.ID_FIELD] self.updated = json_data[config.LAST_UPDATED] try: f(self) finally: ComplexDoc.objects().delete()