Ejemplo n.º 1
0
    def test_client(self):
        import requests
        requests.old_get = requests.get
        requests.get = requests_intercept(self.app, 'http://localhost:8001/')

        dataset = open_url('http://localhost:8001/')
        self.assertEqual(dataset['foo%5B'].name, 'foo%5B')
        self.assertEqual(dataset['foo%5B'][0], 1)

        requests.get = requests.old_get
Ejemplo n.º 2
0
 def setUp(self):                                                            
     # create dataset                                                        
     dataset = DatasetType('test')
     rain = dataset['rain'] = GridType('rain')
     rain['rain'] = BaseType('rain', np.arange(6).reshape(2, 3), dimensions=('y', 'x'))
     rain['x'] = BaseType('x', np.arange(3), units='degrees_east')           
     rain['y'] = BaseType('y', np.arange(2), units='degrees_north')
                                                                             
     # create WSGI app                                                       
     self.app = TestApp(ServerSideFunctions(BaseHandler(dataset)))
                                                                             
     # intercept HTTP requests                                               
     self.requests_get = requests.get                                        
     requests.get = requests_intercept(self.app, 'http://localhost:8001/')   
Ejemplo n.º 3
0
 def setUp(self):                                                            
     # create dataset                                                        
     dataset = DatasetType('EOSDB.DBO', type='Drifters')
     dataset['Drifters'] = SequenceType('Drifters')                          
     dataset['Drifters']['instrument_id'] = BaseType('instrument_id')        
     dataset['Drifters']['location'] = BaseType('location')                  
     dataset['Drifters']['latitude'] = BaseType('latitude')                  
     dataset['Drifters']['longitude'] = BaseType('longitude')                
                                                                             
     dataset.Drifters.data = np.rec.fromrecords(                             
         DATA, names=dataset.Drifters.keys())                                
                                                                             
     # create WSGI app                                                       
     self.app = TestApp(BaseHandler(dataset))                                
                                                                             
     # intercept HTTP requests                                               
     self.requests_get = requests.get                                        
     requests.get = requests_intercept(self.app, 'http://localhost:8001/')