def test_round_trip(self): config = Config() tmp_file = "tmp_config.yml" config.write(tmp_file) self.files_to_remove.append(tmp_file) config_back = read_config(tmp_file) self.assertEqual(config, config_back)
def test_get_waveform_client(self): config = read_config(os.path.join(self.test_path, "default_config.yml")) client = config.rt_match_filter.get_waveform_client() self.assertEqual(client, None) config.rt_match_filter.waveform_client_type = "FDSN" client = config.rt_match_filter.get_waveform_client() self.assertEqual(client, None) config.rt_match_filter.waveform_client = "GEONET" client = config.rt_match_filter.get_waveform_client() self.assertIsInstance(client, Client)
def test_get_client(self): config = read_config(os.path.join(self.test_path, "default_config.yml")) client = config.rt_match_filter.get_client() self.assertIsInstance(client, Client) config.rt_match_filter.client = "WaLrOuS" client = config.rt_match_filter.get_client() self.assertEqual(client, None) config.rt_match_filter.client_type = "aLbATrOsS" client = config.rt_match_filter.get_client() self.assertEqual(client, None)
def test_fail_read(self): with self.assertRaises(FileNotFoundError): read_config("missing_file")
def test_read_no_file(self): config = read_config() self.assertIsInstance(config, Config)
def test_read_config(self): config = read_config(os.path.join(self.test_path, "default_config.yml")) self.assertIsInstance(config, Config)