def test00_start(self): remove_dir(tmp('idepositbox_test')) os.makedirs(tmp('idepositbox_test/dynamic_cache')) os.makedirs(tmp('idepositbox_test/static_cache')) Config.get_config_file_path = lambda a: tmp('idepositbox_test/test_idepositbox.conf') config = Config() Config.mount_type = MOUNT_EXPORT config.webdav_bind_port = 8080 config.cache_dir = tmp('idepositbox_test') config.save() TestIdepositbox.CLIENT = IdepositboxClient() TestIdepositbox.CLIENT.start(SPT_FILE_BASED, CLIENT_KS_PATH, PASSWD) self.assertEqual(TestIdepositbox.CLIENT.get_status(), CS_STARTED) print '** initialized'
def get_test_idepositbox_client(log_level='INFO'): cache_dir = os.path.join(tempfile.gettempdir(), 'test_idepositbox_cache') if os.path.exists(cache_dir): shutil.rmtree(cache_dir) os.mkdir(cache_dir) conf_path = os.path.join(cache_dir, 'test_idepositbox.conf') Config.get_config_file_path = lambda a: conf_path fabnet_gateway.FriClient = MockedFriClient data_block.READ_TRY_COUNT = 1 config = Config() config.log_level = log_level config.mount_type = MOUNT_EXPORT config.cache_dir = cache_dir config.webdav_bind_host = '127.0.0.1' config.webdav_bind_port = 9997 config.ca_address = '127.0.0.1:9998' config.save() return MockedIdepositboxClient()