def test_setters_none(self): req = HTTPRequest() req.method = None req.resource = None req.headers = None req.query_params = None req.content = None req.ignore404 = None self.assertIsInstance(req, HTTPRequest) self.assertTrue(hasattr(req, "content")) self.assertIsNone(req.content) self.assertTrue(hasattr(req, "ignore404")) self.assertFalse(req.ignore404) self.assertTrue(hasattr(req, "method")) self.assertIsNone(req.method) self.assertTrue(hasattr(req, "resource")) self.assertIsNone(req.resource) self.assertTrue(hasattr(req, "headers")) self.assertEqual(req.headers, {}) self.assertTrue(hasattr(req, "query_params")) self.assertEqual(req.query_params, {})
def test_setters(self): req = HTTPRequest() req.method = "method test" req.resource = "resource test" req.headers = {"test": "val"} req.query_params = {"test": "val"} req.content = "content test" req.ignore404 = True self.assertIsInstance(req, HTTPRequest) self.assertEqual(req.method, "method test") self.assertEqual(req.resource, "resource test") self.assertEqual(req.headers, {"test": "val"}) self.assertEqual(req.query_params, {"test": "val"}) self.assertEqual(req.content, "content test") self.assertTrue(req.ignore404)