+class RedirectResponse(unittest.TestCase):
+ def test_takes_location_as_positional_argument(self):
+ response = phial.RedirectResponse('/location')
+ self.assertEqual(response.location, '/location')
+
+ def test_takes_location_as_keyword_argument(self):
+ response = phial.RedirectResponse(location='/location')
+ self.assertEqual(response.location, '/location')
+
+ def test_permanent_defaults_to_true(self):
+ response = phial.RedirectResponse('/location')
+ self.assertEqual(response.permanent, True)
+
+ def test_status(self):
+ self.assertEqual(
+ phial.RedirectResponse('/location', permanent=True).status,
+ 308,
+ )
+ self.assertEqual(
+ phial.RedirectResponse('/location', permanent=False).status,
+ 307,
+ )
+
+ def test_headers(self):
+ self.assertEqual(
+ phial.RedirectResponse('/location').headers,
+ (('Location','/location'),),
+ )
+
+ def test_content(self):
+ self.assertEqual(
+ phial.RedirectResponse('/location').content,
+ (b'',),
+ )
+