def test_response_splitting(self): data = """ RANDOM_KEY=true DATACENTER=GEOFON,http://geofon.gfz-potsdam.de DATASELECTSERVICE=http://geofon.gfz-potsdam1.de/fdsnws/dataselect/1/ STATIONSERVICE=http://geofon.gfz-potsdam2.de/fdsnws/station/1/ AF CER -- BHE 2007-03-15T00:47:00 2599-12-31T23:59:59 AF CER -- BHN 2007-03-15T00:47:00 2599-12-31T23:59:59 DATACENTER=INGV,http://www.ingv.it DATASELECTSERVICE=http://webservices1.rm.ingv.it/fdsnws/dataselect/1/ STATIONSERVICE=http://webservices2.rm.ingv.it/fdsnws/station/1/ EVENTSERVICE=http://webservices.rm.ingv.it/fdsnws/event/1/ AC PUK -- HHE 2009-05-29T00:00:00 2009-12-22T00:00:00 """ self.assertEqual( FederatorRoutingClient._split_routing_response(data, "dataselect"), { "http://geofon.gfz-potsdam1.de": ("AF CER -- BHE 2007-03-15T00:47:00 2599-12-31T23:59:59\n" "AF CER -- BHN 2007-03-15T00:47:00 2599-12-31T23:59:59"), "http://webservices1.rm.ingv.it": ("AC PUK -- HHE 2009-05-29T00:00:00 2009-12-22T00:00:00") }) self.assertEqual( FederatorRoutingClient._split_routing_response(data, "station"), { "http://geofon.gfz-potsdam2.de": ("AF CER -- BHE 2007-03-15T00:47:00 2599-12-31T23:59:59\n" "AF CER -- BHN 2007-03-15T00:47:00 2599-12-31T23:59:59"), "http://webservices2.rm.ingv.it": ("AC PUK -- HHE 2009-05-29T00:00:00 2009-12-22T00:00:00") }) # Error handling. with self.assertRaises(ValueError) as e: FederatorRoutingClient._split_routing_response(data, "random") self.assertEqual(e.exception.args[0], "Service must be 'dataselect' or 'station'.")
def test_response_splitting(self): data = """ RANDOM_KEY=true DATACENTER=GEOFON,http://geofon.gfz-potsdam.de DATASELECTSERVICE=http://geofon.gfz-potsdam1.de/fdsnws/dataselect/1/ STATIONSERVICE=http://geofon.gfz-potsdam2.de/fdsnws/station/1/ AF CER -- BHE 2007-03-15T00:47:00 2599-12-31T23:59:59 AF CER -- BHN 2007-03-15T00:47:00 2599-12-31T23:59:59 DATACENTER=INGV,http://www.ingv.it DATASELECTSERVICE=http://webservices1.rm.ingv.it/fdsnws/dataselect/1/ STATIONSERVICE=http://webservices2.rm.ingv.it/fdsnws/station/1/ EVENTSERVICE=http://webservices.rm.ingv.it/fdsnws/event/1/ AC PUK -- HHE 2009-05-29T00:00:00 2009-12-22T00:00:00 """ self.assertEqual( FederatorRoutingClient._split_routing_response(data, "dataselect"), {"http://geofon.gfz-potsdam1.de": ( "AF CER -- BHE 2007-03-15T00:47:00 2599-12-31T23:59:59\n" "AF CER -- BHN 2007-03-15T00:47:00 2599-12-31T23:59:59"), "http://webservices1.rm.ingv.it": ( "AC PUK -- HHE 2009-05-29T00:00:00 2009-12-22T00:00:00" )}) self.assertEqual( FederatorRoutingClient._split_routing_response(data, "station"), {"http://geofon.gfz-potsdam2.de": ( "AF CER -- BHE 2007-03-15T00:47:00 2599-12-31T23:59:59\n" "AF CER -- BHN 2007-03-15T00:47:00 2599-12-31T23:59:59"), "http://webservices2.rm.ingv.it": ( "AC PUK -- HHE 2009-05-29T00:00:00 2009-12-22T00:00:00" )}) # Error handling. with self.assertRaises(ValueError) as e: FederatorRoutingClient._split_routing_response(data, "random") self.assertEqual(e.exception.args[0], "Service must be 'dataselect' or 'station'.")
def test_response_splitting_fdsnws_subdomain(self): data = """ DATACENTER=NOA,http://bbnet.gein.noa.gr/HL/ DATASELECTSERVICE=http://eida.gein.noa.gr/fdsnws/dataselect/1/ STATIONSERVICE=http://eida.gein.noa.gr/fdsnws/station/1/ HP LTHK * * 2017-10-20T00:00:00 2599-12-31T23:59:59 DATACENTER=RASPISHAKE,http://raspberryshake.net/ DATASELECTSERVICE=http://fdsnws.raspberryshakedata.com/fdsnws/dataselect/1/ STATIONSERVICE=http://fdsnws.raspberryshakedata.com/fdsnws/station/1/ EVENTSERVICE=http://fdsnws.raspberryshakedata.com/fdsnws/event/1/ AM RA14E * * 2017-10-20T00:00:00 2599-12-31T23:59:59 """ self.assertEqual( FederatorRoutingClient._split_routing_response(data, "station"), {"http://eida.gein.noa.gr": "HP LTHK * * 2017-10-20T00:00:00 2599-12-31T23:59:59", "http://fdsnws.raspberryshakedata.com": "AM RA14E * * 2017-10-20T00:00:00 2599-12-31T23:59:59"})
def test_response_splitting_fdsnws_subdomain(self): data = """ DATACENTER=NOA,http://bbnet.gein.noa.gr/HL/ DATASELECTSERVICE=http://eida.gein.noa.gr/fdsnws/dataselect/1/ STATIONSERVICE=http://eida.gein.noa.gr/fdsnws/station/1/ HP LTHK * * 2017-10-20T00:00:00 2599-12-31T23:59:59 DATACENTER=RASPISHAKE,http://raspberryshake.net/ DATASELECTSERVICE=http://fdsnws.raspberryshakedata.com/fdsnws/dataselect/1/ STATIONSERVICE=http://fdsnws.raspberryshakedata.com/fdsnws/station/1/ EVENTSERVICE=http://fdsnws.raspberryshakedata.com/fdsnws/event/1/ AM RA14E * * 2017-10-20T00:00:00 2599-12-31T23:59:59 """ self.assertEqual( FederatorRoutingClient._split_routing_response(data, "station"), {"http://eida.gein.noa.gr": "HP LTHK * * 2017-10-20T00:00:00 2599-12-31T23:59:59", "http://fdsnws.raspberryshakedata.com": "AM RA14E * * 2017-10-20T00:00:00 2599-12-31T23:59:59"})