Example #1
0
 def test_004_partial(self):
     req = Request(None, self.environ)
     req.path = '/up/'
     applied = self.instance(req)
     self.assertEqual(applied.status_code, 201)
     self.assertIsInstance(applied, Created)
     self.assertEqual(applied.content, '1')
Example #2
0
 def test_005_capturing_kwargs(self):
     req = Request(None, self.environ)
     req.path = '/random-slug/'
     applied = self.instance(req)
     self.assertEqual(applied.status_code, 202)
     self.assertIsInstance(applied, Accepted)
     self.assertEqual(applied.content, 'random-slug')
Example #3
0
 def test_003_root(self):
     req = Request(None, self.environ)
     req.path = '/'
     applied = self.instance(req)
     self.assertEqual(applied.status_code, 200)
     self.assertIsInstance(applied, Response)
     self.assertEqual(applied.content, 'OK')
Example #4
0
 def test_002_not_found(self):
     req = Request(None, self.environ)
     req.path = '/abc/def/'
     applied = self.instance(req)
     self.assertEqual(applied.status_code, 400)
     # check for ResponseError because it is the separating point between
     # Response and NotFound
     self.assertIsInstance(applied, ResponseError)
     self.assertIsInstance(applied, BadRequest)
Example #5
0
 def test_006_keep_looking(self):
     req = Request(None, self.environ)
     req.path = '/down/'
     applied = self.instance(req)
     # KeepLooking should be raised, so we end up with the Accepted
     # response.
     self.assertEqual(applied.status_code, 202)
     self.assertIsInstance(applied, Accepted)
     self.assertEqual(applied.content, 'down')