Example #1
0
 def wrapper(self):
     response = self.client.post('/simpledoc/',
                                 data='{"a": "jimmy", "b": 23}',
                                 content_type='application/json')
     json_data = response.get_json()
     self.url = '/simpledoc/%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)
     SimpleDoc.objects().delete()
Example #2
0
 def wrapper(self):
     response = self.client.post('/simpledoc/',
                                 data='{"a": "jimmy", "b": 23}',
                                 content_type='application/json')
     json_data = response.get_json()
     self.url = '/simpledoc/%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)
     SimpleDoc.objects().delete()
Example #3
0
    def wrapper(self):
        response = self.client.post(
            "/simpledoc/",
            data='{"a": "jimmy", "b": 23}',
            content_type="application/json",
        )
        json_data = response.get_json()
        self._id = json_data[config.ID_FIELD]

        self.url = "/simpledoc/%s" % self._id  # json_data[config.ID_FIELD]
        # response = self.client.get(self.url).get_json()
        self.etag = json_data[config.ETAG]
        self.updated = json_data[config.LAST_UPDATED]
        try:
            f(self)
        finally:
            SimpleDoc.objects().delete()
 def test_delete_empty_resource(self):
     SimpleDoc.objects().delete()
     response = self.delete('/simpledoc')
     self.assertEqual(response.status_code, 200)
 def tearDown(self):
     SimpleDoc.objects().delete()
Example #6
0
 def tearDown(self):
     SimpleDoc.objects().delete()
Example #7
0
 def test_delete_empty_resource(self):
     SimpleDoc.objects().delete()
     response = self.delete('/simpledoc')
     self.assertEqual(response.status_code, 200)