def test_add_arg(self): class Resource(BaseResource): def GET(self): pass with self.assertRaises(TypeError): self.app.load_config(config('*/*', xxx=True)(Resource)) self.app.add_config_field('*/*', 'xxx', False) self.app.load_config(config('*/*', xxx=True)(Resource)) resource = Resource(None, None) info = Config.for_resource(self.app, resource, 'GET', 'text/html') self.assertTrue(hasattr(info, 'xxx')) self.assertTrue(info.xxx)
def test_no_args_raises_TypeError(self): with self.assertRaises(TypeError): config('*/*')(type('Resource', (), {}))