예제 #1
0
    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)
예제 #2
0
    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)
예제 #3
0
 def test_no_args_raises_TypeError(self):
     with self.assertRaises(TypeError):
         config('*/*')(type('Resource', (), {}))
예제 #4
0
 def test_no_args_raises_TypeError(self):
     with self.assertRaises(TypeError):
         config('*/*')(type('Resource', (), {}))