def test_config_backup_list(mock_requests_get): fauxapi = PfsenseFauxapi(host=None, apikey=None, apisecret=None) mock_requests_get.return_value.status_code = 200 mock_requests_get.return_value.text = '{"callid": "5c8dc4987c3f8", "action": "config_backup_list", "message": "ok", "data": {"backup_files": []}}' response = fauxapi.config_backup_list() assert response['action'] == 'config_backup_list' assert response['message'] == 'ok' assert response['data'] is not None
# config reload # ============================================================================= print(json.dumps( FauxapiLib.config_reload()) ) # config backuo # ============================================================================= print(json.dumps( FauxapiLib.config_backup()) ) # config_backup_list # ============================================================================= print(json.dumps( FauxapiLib.config_backup_list()) ) # # config_restore # ============================================================================= # print(json.dumps( # FauxapiLib.config_restore('/cf/conf/backup/config-1530604754.xml')) # ) # system_stats # ============================================================================= print(json.dumps( FauxapiLib.system_stats()) ) # interface_stats - NB: the real interface name, not an interface alias such as "WAN" or "LAN"
# config get the full configuration again so we can manually confirm it has been restored config = FauxapiLib.config_get() print(json.dumps(config)) # config reload # ============================================================================= print(json.dumps(FauxapiLib.config_reload())) # config backuo # ============================================================================= print(json.dumps(FauxapiLib.config_backup())) # config_backup_list # ============================================================================= print(json.dumps(FauxapiLib.config_backup_list())) # # config_restore # ============================================================================= # print(json.dumps( # FauxapiLib.config_restore('/cf/conf/backup/config-1530604754.xml')) # ) # system_stats # ============================================================================= print(json.dumps(FauxapiLib.system_stats())) # interface_stats - NB: the real interface name, not an interface alias such as "WAN" or "LAN" # ============================================================================= print(json.dumps(FauxapiLib.interface_stats('em0')))