Exemplo n.º 1
0
    def __init__(self, config):
        matplotlib.use('Agg')
        RESTFormatter.__init__(self, config)

        self.supporttypes = {'image/png': self.png,
                             '*/*': self.png,
                             'application/pdf': self.pdf,
                             'image/svg+xml':self.svg}
Exemplo n.º 2
0
 def __init__(self, config):
     "Initialise the formatter and set the mime types it supports"
     RESTFormatter.__init__(self, config)
     mimes = {
         'text/json+das': self.dasjson,
         'application/xml+das': self.xml,
         'application/plist': self.plist
     }
     self.supporttypes.update(mimes)
Exemplo n.º 3
0
 def __init__(self, config):
     RESTFormatter.__init__(self, config)
     self.supporttypes = {'application/xml': self.xml,
                          'application/atom+xml': self.atom,
                          'text/json': self.json,
                          'text/x-json': self.json,
                          'application/json': self.json,
                          'text/html': self.to_string,
                          'text/plain': self.to_string,
                          '*/*': self.json}
Exemplo n.º 4
0
    def __init__(self, config):
	RESTFormatter.__init__(self, config)
        self.supporttypes = {'application/xml': self.xml,
                   'application/atom+xml': self.atom,
                   'text/json': self.json,
                   'text/x-json': self.json,
                   'application/json': self.json,
                   'text/html': self.to_string,
                   'text/plain': self.to_string,
                   '*/*': self.json}
Exemplo n.º 5
0
    def __init__(self, config):
        matplotlib.use('Agg')
        RESTFormatter.__init__(self, config)

        self.supporttypes = {
            'image/png': self.png,
            '*/*': self.png,
            'application/pdf': self.pdf,
            'image/svg+xml': self.svg
        }
Exemplo n.º 6
0
 def testGenerator(self):
     rf = RESTFormatter(config=self.config.Webtools)
     url = self.urlbase +'gen'
     # gen method from DummyRESTModel will return this generator
     gen = ({'idx':i} for i in range(10))
     # the WMCore should convert it into list regardless of accept type
     data = rf.json(gen)
     methodTest('GET', url, accept='application/json',
                      output={'code':200, 'data':data})
     methodTest('GET', url, accept='*/*',
                      output={'code':200, 'data':data})
Exemplo n.º 7
0
 def testGenerator(self):
     rf = RESTFormatter(config=self.config.Webtools)
     url = self.urlbase +'gen'
     # gen method from DummyRESTModel will return this generator
     gen = ({'idx':i} for i in range(10))
     # the WMCore should convert it into list regardless of accept type
     data = rf.json(gen)
     methodTest('GET', url, accept='application/json',
                      output={'code':200, 'data':data})
     methodTest('GET', url, accept='*/*',
                      output={'code':200, 'data':data})
Exemplo n.º 8
0
    def testSupportedFormat(self):
        rf = RESTFormatter(config=self.config.Webtools)
        url = self.urlbase +'list1/'

        for type in rf.supporttypes.keys():
            # test accepted type should return 200 error
            methodTest('GET', url, accept=type, output={'code':200})
Exemplo n.º 9
0
 def __init__(self, config):
     "Initialise the formatter and set the mime types it supports"
     RESTFormatter.__init__(self, config)
     mimes = {'text/json+das':self.dasjson, 'application/xml+das':self.xml,
              'application/plist':self.plist}
     self.supporttypes.update(mimes)