def test_config_backup(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": "5c8dc46901d7f", "action": "config_backup", "message": "ok", "data": {"backup_config_file": "/cf/conf/backup/config-1552794729.xml"}}' response = fauxapi.config_backup() assert response['action'] == 'config_backup' assert response['message'] == 'ok' assert response['data'] is not None
# 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
config['system']['hostname'], } } print(json.dumps(FauxapiLib.config_patch(config_patch))) # 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()))