Beispiel #1
0
 def get(self):
     self.response.headers['Content-Type'] = 'application/json'
     json.dump(discovery.directory(api_classes, base_path),
               self.response,
               indent=2,
               sort_keys=True,
               separators=(',', ':'))
Beispiel #2
0
 def test_directory(self):
     """Tests for discovery.directory."""
     expected = {
         'discoveryVersion':
         'v1',
         'items': [
             {
                 'description': 'A service to test with.',
                 'discoveryLink': './apis/service/v1/rest',
                 'discoveryRestUrl':
                 'https://None/api/discovery/v1/apis/service/v1/rest',
                 'icons': {
                     'x16':
                     'https://www.google.com/images/icons/product/search-16.gif',
                     'x32':
                     'https://www.google.com/images/icons/product/search-32.gif',
                 },
                 'id': 'service:v1',
                 'kind': 'discovery#directoryItem',
                 'name': 'service',
                 'preferred': True,
                 'version': 'v1',
             },
         ],
         'kind':
         'discovery#directoryList',
     }
     self.assertEqual(discovery.directory([Service], '/api'), expected)