def test_collect_single_servers(log_depot, appliance, depot_machine_ip, request, zone_collect, collect_type): log_depot.machine_ip = depot_machine_ip @request.addfinalizer def _clear_ftp(): with log_depot.ftp as ftp: ftp.cwd(ftp.upload_dir) ftp.recursively_delete() # Prepare empty workspace with log_depot.ftp as ftp: # move to upload folder ftp.cwd(ftp.upload_dir) # delete all files ftp.recursively_delete() uri = log_depot.machine_ip + log_depot.access_dir depot = configure.ServerLogDepot(log_depot.protocol, depot_name=fauxfactory.gen_alphanumeric(), uri=uri, username=log_depot.credentials["username"], password=log_depot.credentials["password"], zone_collect=zone_collect ) depot.create() if collect_type == 'all': depot.collect_all() else: depot.collect_current() check_ftp(log_depot.ftp, appliance.server_name(), appliance.server_zone_id())
def test_collect_unconfigured(appliance): """ Test checking is collect button enable and disable after log depot was configured """ log_credentials = configure.ServerLogDepot("anon_ftp", depot_name=fauxfactory.gen_alphanumeric(), uri=fauxfactory.gen_alphanumeric()) log_credentials.create() view = navigate_to(appliance.server, 'DiagnosticsCollectLogs') # check button is enable after adding log depot assert view.collect.item_enabled('Collect all logs') is True log_credentials.clear() # check button is disable after removing log depot assert view.collect.item_enabled('Collect all logs') is False
def configured_depot(log_depot, depot_machine_ip): """ Configure selected depot provider This fixture used the trick that the fixtures are cached for given function. So if placed behind the depot_* stuff on the test function, it can actually take the values from them. It also provides a finalizer to disable the depot after test run. """ log_depot.machine_ip = depot_machine_ip uri = log_depot.machine_ip + log_depot.access_dir log_depot = configure.ServerLogDepot(log_depot.protocol, depot_name=fauxfactory.gen_alphanumeric(), uri=uri, username=log_depot.credentials["username"], password=log_depot.credentials["password"] ) log_depot.create() yield log_depot log_depot.clear()