Ejemplo n.º 1
0
 def __init__(self, wok_options):
     Resource.__init__(self, model)
     self.description = Description(model)
     self.rectangles = Rectangles(model)
     self.circles = Circles(model)
     self.paths = PluginPaths('sample')
     self.domain = 'sample'
     self.messages = messages
     self.api_schema = json.load(open(os.path.join(os.path.dirname(
                                 os.path.abspath(__file__)), 'API.json')))
Ejemplo n.º 2
0
 def __init__(self, wok_options):
     Resource.__init__(self, model)
     self.description = Description(model)
     self.rectangles = Rectangles(model)
     self.circles = Circles(model)
     self.paths = PluginPaths('sample')
     self.domain = 'sample'
     self.messages = messages
     self.api_schema = json.load(open(os.path.join(os.path.dirname(
                                 os.path.abspath(__file__)), 'API.json')))
Ejemplo n.º 3
0
    def test_resource(self):
        r = Resource(model)

        # Test the base Resource representation
        cherrypy.request.method = 'GET'
        cherrypy.request.headers['Accept'] = 'application/json'
        self.assertEqual('{}', r.index().decode('utf-8'))

        # POST and DELETE raise HTTP:405 by default
        for method in ('POST', 'DELETE'):
            cherrypy.request.method = method
            try:
                r.index()
            except cherrypy.HTTPError as e:
                self.assertEqual(405, e.code)
            else:
                self.fail('Expected exception not raised')
Ejemplo n.º 4
0
    def test_resource(self):
        r = Resource(model)

        # Test the base Resource representation
        cherrypy.request.method = 'GET'
        cherrypy.request.headers['Accept'] = 'application/json'
        self.assertEquals('{}', r.index())

        # POST and DELETE raise HTTP:405 by default
        for method in ('POST', 'DELETE'):
            cherrypy.request.method = method
            try:
                r.index()
            except cherrypy.HTTPError, e:
                self.assertEquals(405, e.code)
            else:
                self.fail("Expected exception not raised")