Esempio n. 1
0
 def test_post_doublepost(self):
     response = self.post("/records/dblfoo/bar/last", content_type="application/json",
         body=json.dumps({"dblfoo/bar/last": [self.data[-1]]}))
     self.assertEqual(response.status_int, 204)
     response = self.post("/records/dblfoo/bar/last", content_type="application/json",
         body=json.dumps({"dblfoo/bar/last": [self.data[-2]]}))
     self.assertEqual(response.status_int, 204)
Esempio n. 2
0
 def test_magic_params_content(self):
     response = self.post("/records/magicjson/bar/last?_content=application/json",
         content_type="text/csv",
         body=json.dumps({"magicjson/bar/last": [self.data[-1]]}))
     self.assertEqual(response.status_int, 204)
     response = self.post("/records/magicbad/bar/last?_content=text/csv",
         content_type="application/json",
         body=json.dumps({"magicbad/bar/last": [self.data[-1]]}))
     self.assertEqual(response.status_int, 400)
Esempio n. 3
0
 def test_magic_params_method(self):
     path = "/records/magicjson/bar/last?_method=POST"
     req = self.req(path, method="GET")
     req.content_type = "application/json"
     req.body = json.dumps({"magicjson/bar/last": [self.data[-1]]})
     response = req.get_response(self.application)
     self.assertEqual(response.status_int, 204)
Esempio n. 4
0
 def test_post_badvalue(self):
     response = self.post("/records/foo/bar/last", content_type="application/json",
         body=json.dumps({"foo/bar/last": [(self.first, "ten")]}))
     self.assertEqual(response.status_int, 400)
Esempio n. 5
0
 def test_post_badkey(self):
     response = self.post("/records/foo!/bar/last", content_type="application/json",
         body=json.dumps({"foo!/bar/last": [self.data[-1]]}))
     self.assertEqual(response.status_int, 400)
Esempio n. 6
0
 def test_post_bulk(self):
     response = self.post("/records/foo/bar/last", content_type="application/json",
         body=json.dumps({"foo/bar/last": self.data}))
     self.assertEqual(response.status_int, 204)