def test_setting_attributes(self): environ = { 'REQUEST_METHOD': "GET", } req = TwodWSGIRequest(environ) req.foo = "bar" ok_(hasattr(req, "foo")) eq_(req.foo, "bar") # Making sure they're in the WebOb ad-hoc attributes dict, with nothing # else: ok_("webob.adhoc_attrs" in req.environ) eq_(len(req.environ['webob.adhoc_attrs']), 1, "WebOb.Request has the following ad-hoc attributes: %s" % req.environ['webob.adhoc_attrs']) ok_("foo" in req.environ['webob.adhoc_attrs'])
def test_setting_attributes(self): environ = { 'REQUEST_METHOD': "GET", } req = TwodWSGIRequest(environ) req.foo = "bar" self.assertTrue(hasattr(req, "foo")) self.assertEqual(req.foo, "bar") # Making sure they're in the WebOb ad-hoc attributes dict, with nothing # else: self.assertIn("webob.adhoc_attrs", req.environ) self.assertEqual(len(req.environ['webob.adhoc_attrs']), 1, "WebOb.Request has the following ad-hoc attributes: %s" % req.environ['webob.adhoc_attrs']) self.assertIn("foo", req.environ['webob.adhoc_attrs'])
def test_setting_attributes(self): environ = { 'REQUEST_METHOD': "GET", } req = TwodWSGIRequest(environ) req.foo = "bar" ok_(hasattr(req, "foo")) eq_(req.foo, "bar") # Making sure they're in the WebOb ad-hoc attributes dict, with nothing # else: ok_("webob.adhoc_attrs" in req.environ) eq_( len(req.environ['webob.adhoc_attrs']), 1, "WebOb.Request has the following ad-hoc attributes: %s" % req.environ['webob.adhoc_attrs']) ok_("foo" in req.environ['webob.adhoc_attrs'])