Esempio n. 1
0
 def test_getcapabilities_repeat(self):
     for i in range(10):
         html_response = wpsxml.wps_response(
             self.wps_host,
             '?service=WPS&request=GetCapabilities&version=1.0.0',
             self.client)
         self.assertTrue(html_response)
 def test_getcapabilities_repeat(self):
     for i in range(10):
         html_response = wpsxml.wps_response(
             self.wps_host,
             '?service=WPS&request=GetCapabilities&version=1.0.0',
             self.client)
         self.assertTrue(html_response)
 def test_process_exists_getpoint(self):
     html_response = wpsxml.wps_response(
         self.wps_host,
         '?service=WPS&request=GetCapabilities&version=1.0.0',
         self.client)
     processes = wpsxml.parse_getcapabilities(html_response)
     self.assertTrue('getpoint' in processes)
Esempio n. 4
0
 def test_pavicsearch_01(self):
     if (not self.wps_host) and (not self.solr_host):
         raise unittest.SkipTest('Solr host not defined in config.')
     html_response = wpsxml.wps_response(
         self.wps_host, ('?service=WPS&request=execute&version=1.0.0&'
                         'identifier=pavicsearch&DataInputs='), self.client)
     outputs = wpsxml.parse_execute_response(html_response)
     self.assertTrue('search_result' in outputs['outputs'])
Esempio n. 5
0
 def test_describeprocess_pavicsearch(self):
     html_response = wpsxml.wps_response(
         self.wps_host,
         ('?service=WPS&request=DescribeProcess&version=1.0.0&'
          'identifier=pavicsearch'), self.client)
     describe_process = wpsxml.parse_describeprocess(html_response)
     self.assertTrue('facets' in describe_process['inputs'])
     self.assertTrue('search_result' in describe_process['outputs'])
Esempio n. 6
0
 def test_describeprocess_getpoint(self):
     html_response = wpsxml.wps_response(
         self.wps_host,
         ('?service=WPS&request=DescribeProcess&version=1.0.0&'
          'identifier=getpoint'), self.client)
     describe_process = wpsxml.parse_describeprocess(html_response)
     self.assertTrue('opendap_url' in describe_process['inputs'])
     self.assertTrue('point_result' in describe_process['outputs'])
 def test_describeprocess_getpoint(self):
     html_response = wpsxml.wps_response(
         self.wps_host,
         ('?service=WPS&request=DescribeProcess&version=1.0.0&'
          'identifier=getpoint'),
         self.client)
     describe_process = wpsxml.parse_describeprocess(html_response)
     self.assertTrue('opendap_url' in describe_process['inputs'])
     self.assertTrue('point_result' in describe_process['outputs'])
 def test_describeprocess_pavicrawler(self):
     html_response = wpsxml.wps_response(
         self.wps_host,
         ('?service=WPS&request=DescribeProcess&version=1.0.0&'
          'identifier=pavicrawler'),
         self.client)
     describe_process = wpsxml.parse_describeprocess(html_response)
     self.assertTrue('target_files' in describe_process['inputs'])
     self.assertTrue('crawler_result' in describe_process['outputs'])
 def test_pavicrawler_01(self):
     # Crawl, then search and WMS link validation
     if (not self.wps_host) and (not self.solr_host):
         raise unittest.SkipTest('Solr host not defined in config.')
     wpsxml.config_is_available(
         ['thredds_host', 'target_file', 'target_search', 'target_wms'],
         self.config_dict)
     html_response = wpsxml.wps_response(
         self.wps_host,
         ('?service=WPS&request=execute&version=1.0.0&'
          'identifier=pavicrawler&DataInputs='
          'target_files={0}').format(self.config_dict['target_file']),
         self.client)
     html_response = wpsxml.wps_response(
         self.wps_host,
         ('?service=WPS&request=execute&version=1.0.0&'
          'identifier=pavicsearch&DataInputs='
          'type=File;query={0}').format(self.config_dict['target_search']),
         self.client)
     outputs = wpsxml.parse_execute_response(html_response)
     search_json = wpsxml.get_wps_xlink(outputs['outputs']['search_result'])
     search_json = json.loads(search_json)
     self.assertEqual(search_json['response']['docs'][0]['wms_url'],
                      self.config_dict['target_wms'])
 def test_pavicrawler_01(self):
     # Crawl, then search and WMS link validation
     if (not self.wps_host) and (not self.solr_host):
         raise unittest.SkipTest('Solr host not defined in config.')
     wpsxml.config_is_available(
         ['thredds_host', 'target_file', 'target_search', 'target_wms'],
         self.config_dict)
     html_response = wpsxml.wps_response(
         self.wps_host,
         ('?service=WPS&request=execute&version=1.0.0&'
          'identifier=pavicrawler&DataInputs='
          'target_files={0}').format(self.config_dict['target_file']),
         self.client)
     html_response = wpsxml.wps_response(
         self.wps_host,
         ('?service=WPS&request=execute&version=1.0.0&'
          'identifier=pavicsearch&DataInputs='
          'type=File;query={0}').format(self.config_dict['target_search']),
         self.client)
     outputs = wpsxml.parse_execute_response(html_response)
     search_json = wpsxml.get_wps_xlink(outputs['outputs']['search_result'])
     search_json = json.loads(search_json)
     self.assertEqual(search_json['response']['docs'][0]['wms_url'],
                      self.config_dict['target_wms'])
 def test_pavicrawler_missing_file(self):
     # Missing file
     wpsxml.config_is_available(['thredds_host', 'target_file_missing'],
                                self.config_dict)
     # Need to redirect stderr since a test WpsClient will output the error
     save_stderr = sys.stderr
     sys.stderr = io.BytesIO()
     html_response = wpsxml.wps_response(
         self.wps_host, ('?service=WPS&request=execute&version=1.0.0&'
                         'identifier=pavicrawler&DataInputs='
                         'target_files={0}').format(
                             self.config_dict['target_file_missing']),
         self.client)
     # Restoring stderr
     sys.stderr = save_stderr
     outputs = wpsxml.parse_execute_response(html_response)
     self.assertEqual(outputs['status'], 'ProcessFailed')
 def test_pavicrawler_missing_file(self):
     # Missing file
     wpsxml.config_is_available(
         ['thredds_host', 'target_file_missing'],
         self.config_dict)
     # Need to redirect stderr since a test WpsClient will output the error
     save_stderr = sys.stderr
     sys.stderr = io.BytesIO()
     html_response = wpsxml.wps_response(
         self.wps_host,
         ('?service=WPS&request=execute&version=1.0.0&'
          'identifier=pavicrawler&DataInputs='
          'target_files={0}').format(
             self.config_dict['target_file_missing']),
         self.client)
     # Restoring stderr
     sys.stderr = save_stderr
     outputs = wpsxml.parse_execute_response(html_response)
     self.assertEqual(outputs['status'], 'ProcessFailed')
 def test_getpoint_01(self):
     wpsxml.config_is_available(
         ['netcdf_file', 'var_name', 'nearest_lon', 'nearest_lat',
          'nearest_time', 'point_value', 'precision'], self.config_dict)
     format_inputs = [self.config_dict['netcdf_file'],
                      self.config_dict['var_name'],
                      self.config_dict['nearest_lon'],
                      self.config_dict['nearest_lat'],
                      self.config_dict['nearest_time']]
     html_response = wpsxml.wps_response(
         self.wps_host,
         ('?service=WPS&request=execute&version=1.0.0&'
          'identifier=getpoint&DataInputs='
          'opendap_url={0};variable={1};nearest_to=lon:{2};'
          'nearest_to=lat:{3};nearest_to=time:{4}').format(*format_inputs),
         self.client)
     outputs = wpsxml.parse_execute_response(html_response)
     search_json = wpsxml.get_wps_xlink(outputs['outputs']['point_result'])
     search_json = json.loads(search_json)
     self.assertAlmostEqual(
         float(search_json[self.config_dict['var_name']]['value']),
         float(self.config_dict['point_value']),
         places=int(self.config_dict['precision']))
Esempio n. 14
0
 def test_getpoint_01(self):
     wpsxml.config_is_available([
         'netcdf_file', 'var_name', 'nearest_lon', 'nearest_lat',
         'nearest_time', 'point_value', 'precision'
     ], self.config_dict)
     format_inputs = [
         self.config_dict['netcdf_file'], self.config_dict['var_name'],
         self.config_dict['nearest_lon'], self.config_dict['nearest_lat'],
         self.config_dict['nearest_time']
     ]
     html_response = wpsxml.wps_response(
         self.wps_host,
         ('?service=WPS&request=execute&version=1.0.0&'
          'identifier=getpoint&DataInputs='
          'opendap_url={0};variable={1};nearest_to=lon:{2};'
          'nearest_to=lat:{3};nearest_to=time:{4}').format(*format_inputs),
         self.client)
     outputs = wpsxml.parse_execute_response(html_response)
     search_json = wpsxml.get_wps_xlink(outputs['outputs']['point_result'])
     search_json = json.loads(search_json)
     self.assertAlmostEqual(float(
         search_json[self.config_dict['var_name']]['value']),
                            float(self.config_dict['point_value']),
                            places=int(self.config_dict['precision']))
Esempio n. 15
0
 def test_process_exists_pavicsearch(self):
     html_response = wpsxml.wps_response(
         self.wps_host,
         '?service=WPS&request=GetCapabilities&version=1.0.0', self.client)
     processes = wpsxml.parse_getcapabilities(html_response)
     self.assertTrue('pavicsearch' in processes)