async def test_geographic_rectangular( self, server_config, tester, eidaws_routing_path_query, fdsnws_station_text_content_type, load_data, method, params_or_data, ): mocked_routing = { "localhost": [( eidaws_routing_path_query, method, web.Response( status=200, text=( "http://geofon.gfz-potsdam.de/fdsnws/station/1/query\n" "UP FABU * * 2012-07-31T00:00:00.000001\n"), ), )] } config_dict = server_config(self.get_config) endpoint_request_method = self.lookup_config("endpoint_request_method", config_dict) mocked_endpoints = { "geofon.gfz-potsdam.de": [ ( self.PATH_RESOURCE, endpoint_request_method, web.Response( status=200, text=load_data( "UP.FABU.....station", reader="read_text", ), ), ), ], } expected = { "status": 200, "content_type": fdsnws_station_text_content_type, "result": "UP.FABU.....station", } await tester( self.FED_PATH_RESOURCE, method, params_or_data, self.create_app(config_dict=config_dict), mocked_routing, mocked_endpoints, expected, )
async def test_cached( self, server_config, tester, eidaws_routing_path_query, eidaws_wfcatalog_content_type, load_data, cache_config, method, params_or_data, ): mocked_routing = { "localhost": [( eidaws_routing_path_query, method, web.Response( status=200, text= ("http://eida.ethz.ch/eidaws/wfcatalog/1/query\n" "CH HASLI -- BHZ 2020-01-01T00:00:00 2020-01-03T00:00:00\n" ), ), )] } config_dict = server_config(self.get_config, **cache_config) mocked_endpoints = { "eida.ethz.ch": [ ( self.PATH_RESOURCE, self.lookup_config("endpoint_request_method", config_dict), web.Response( status=200, body=load_data("CH.HASLI..BHZ.2020-01-01.2020-01-03"), ), ), ] } expected = { "status": 200, "content_type": eidaws_wfcatalog_content_type, "result": "CH.HASLI..BHZ.2020-01-01.2020-01-03", } await tester( self.FED_PATH_RESOURCE, method, params_or_data, self.create_app(config_dict=config_dict), mocked_routing, mocked_endpoints, expected, test_cached=True, )
async def test_cached( self, server_config, tester, eidaws_routing_path_query, fdsnws_station_xml_content_type, load_data, cache_config, method, params_or_data, ): mocked_routing = { "localhost": [( eidaws_routing_path_query, method, web.Response( status=200, text=("http://www.orfeus-eu.org/fdsnws/station/1/query\n" "NL * * * 1997-11-25T00:00:00.000001\n"), ), )] } config_dict = server_config(self.get_config, **cache_config) mocked_endpoints = { "www.orfeus-eu.org": [( self.PATH_RESOURCE, self.lookup_config("endpoint_request_method", config_dict), web.Response( status=200, text=load_data( "NL....1993-01-01.network", reader="read_text", ), ), )] } expected = { "status": 200, "content_type": fdsnws_station_xml_content_type, "result": [(1, [])], } await tester( self.FED_PATH_RESOURCE, method, params_or_data, self.create_app(config_dict=config_dict), mocked_routing, mocked_endpoints, expected, test_cached=True, )
async def test_single_stream_epoch( self, server_config, tester, eidaws_routing_path_query, fdsnws_dataselect_content_type, load_data, method, params_or_data, ): mocked_routing = { "localhost": [( eidaws_routing_path_query, method, web.Response( status=200, text=("http://eida.ethz.ch/fdsnws/dataselect/1/query\n" "CH HASLI -- LHZ " "2019-01-01T00:00:00 2019-01-05T00:00:00\n"), ), )] } config_dict = server_config(self.get_config) mocked_endpoints = { "eida.ethz.ch": [ ( self.PATH_RESOURCE, self.lookup_config("endpoint_request_method", config_dict), web.Response( status=200, body=load_data( "CH.HASLI..LHZ.2019-01-01.2019-01-05T00:05:45"), ), ), ] } expected = { "status": 200, "content_type": fdsnws_dataselect_content_type, "result": "CH.HASLI..LHZ.2019-01-01.2019-01-05T00:05:45", } await tester( self.FED_PATH_RESOURCE, method, params_or_data, self.create_app(config_dict=config_dict), mocked_routing, mocked_endpoints, expected, )
async def test_single_sncl_level_station( self, server_config, tester, eidaws_routing_path_query, fdsnws_station_xml_content_type, load_data, method, params_or_data, ): mocked_routing = { "localhost": [( eidaws_routing_path_query, method, web.Response( status=200, text=("http://www.orfeus-eu.org/fdsnws/station/1/query\n" "NL HGN * * 2009-04-27T00:00:00.000001\n"), ), )] } config_dict = server_config(self.get_config) mocked_endpoints = { "www.orfeus-eu.org": [( self.PATH_RESOURCE, self.lookup_config("endpoint_request_method", config_dict), web.Response( status=200, text=load_data( "NL.HGN...2001-06-06.station", reader="read_text", ), ), )] } expected = { "status": 200, "content_type": fdsnws_station_xml_content_type, "result": [(1, [(1, 0)])], } await tester( self.FED_PATH_RESOURCE, method, params_or_data, self.create_app(config_dict=config_dict), mocked_routing, mocked_endpoints, expected, )
async def test_multi_nets_multi_dcs( self, server_config, tester, eidaws_routing_path_query, fdsnws_station_xml_content_type, load_data, method, params_or_data, ): mocked_routing = { "localhost": [( eidaws_routing_path_query, method, web.Response( status=200, text=("http://eida.ethz.ch/fdsnws/station/1/query\n" "CH HASLI -- BHZ 1999-06-16T00:00:00.000001\n" "\n" "http://www.orfeus-eu.org/fdsnws/station/1/query\n" "NL HGN 02 BHZ 2009-04-27T00:00:00.000001\n"), ), )] } config_dict = server_config(self.get_config) endpoint_request_method = self.lookup_config("endpoint_request_method", config_dict) mocked_endpoints = { "eida.ethz.ch": [ ( self.PATH_RESOURCE, endpoint_request_method, web.Response( status=200, text=load_data( "CH.HASLI..BHZ.1999-06-16.channel", reader="read_text", ), ), ), ], "www.orfeus-eu.org": [ ( self.PATH_RESOURCE, endpoint_request_method, web.Response( status=200, text=load_data( "NL.HGN.02.BHZ.2009-04-27.channel", reader="read_text", ), ), ), ], } expected = { "status": 200, "content_type": fdsnws_station_xml_content_type, "result": [(1, [(1, 1)]), (1, [(1, 1)])], } await tester( self.FED_PATH_RESOURCE, method, params_or_data, self.create_app(config_dict=config_dict), mocked_routing, mocked_endpoints, expected, )
async def test_single_net_multi_stas( self, server_config, tester, eidaws_routing_path_query, fdsnws_station_text_content_type, load_data, method, params_or_data, ): mocked_routing = { "localhost": [( eidaws_routing_path_query, method, web.Response( status=200, text= ("http://www.orfeus-eu.org/fdsnws/station/1/query\n" "NL DBN -- BHZ " "1997-11-25T00:00:00.000001 2018-06-30T23:58:59.999999\n" "NL HGN 02 BHZ 2009-04-27T00:00:00.000001\n"), ), )] } config_dict = server_config(self.get_config) endpoint_request_method = self.lookup_config("endpoint_request_method", config_dict) mocked_endpoints = { "www.orfeus-eu.org": [ ( self.PATH_RESOURCE, endpoint_request_method, web.Response( status=200, text=load_data( "NL.DBN..BHZ.1997-11-25.2018-06-03.channel", reader="read_text", ), ), ), ( self.PATH_RESOURCE, endpoint_request_method, web.Response( status=200, text=load_data( "NL.HGN.02.BHZ.2009-04-27.channel", reader="read_text", ), ), ), ] } expected = { "status": 200, "content_type": fdsnws_station_text_content_type, "result": "NL.DBN,HGN..BHZ.2013-11-10.2013-11-11.channel", } await tester( self.FED_PATH_RESOURCE, method, params_or_data, self.create_app(config_dict=config_dict), mocked_routing, mocked_endpoints, expected, )
async def test_fallback_mseed_record_size( self, server_config, tester, eidaws_routing_path_query, fdsnws_dataselect_content_type, fdsnws_error_content_type, load_data, mseed_fallback_config, method, params_or_data, ): mocked_routing = { "localhost": [( eidaws_routing_path_query, method, web.Response( status=200, text=("http://eida.bgr.de/fdsnws/dataselect/1/query\n" "GR BFO -- HHZ " "2020-02-01T06:30:00 2020-02-01T06:35:00\n"), ), )] } config_dict = server_config(self.get_config, **mseed_fallback_config) mocked_endpoints = { "eida.bgr.de": [ ( self.PATH_RESOURCE, self.lookup_config("endpoint_request_method", config_dict), web.Response( status=200, body=load_data( "GR.BFO..HHZ." "2020-02-01T06:30:00.2020-02-01T06:35:00"), ), ), ] } if self.lookup_config("fallback_mseed_record_size", config_dict): expected = { "status": 200, "content_type": fdsnws_dataselect_content_type, "result": "GR.BFO..HHZ.2020-02-01T06:30:00.2020-02-01T06:35:00", } else: # disabled fallback expected = { "status": 204, "content_type": fdsnws_error_content_type, } await tester( self.FED_PATH_RESOURCE, method, params_or_data, self.create_app(config_dict=config_dict), mocked_routing, mocked_endpoints, expected, )