def test_GIVEN_root_folder_WHEN_read_THEN_return_list_of_files(self): config = ConfigMother.test_configuration() client = ApacheClient(config) result = client.get_contents(config.get(CONFIG_DATA_PATH, CONFIG_DATA_SECTION)) assert_that(result, has_length(greater_than(0))) assert_that(result, is_not(has_item("Parent Directory")))
def test_GIVEN_file_WHEN_download_THEN_file_saved_to_filehandle(self): config = ConfigMother.test_configuration() client = ApacheClient(config) filehandle = Mock() url = "http://localhost/public/jules_bd/data/WATCH_2D/driving/LWdown_WFD/LWdown_WFD_190101.nc" client.download_file(url, filehandle) assert_that(filehandle.write.called, is_(True), "Check that something is written to the file handle")
def test_GIVEN_majic_is_up_WHEN_get_file_properties_THEN_data_returned(self): config = ConfigMother.test_configuration() client = MajicWebserviceClient(config) try: result = client.get_properties_list() except WebserviceClientError as ex: if ex.message.startswith("There is a connection error when contacting the Majic Web Service"): raise self.skipTest("Connection error talking with Majic Web service") else: raise ex assert_that(result, is_not(None))