Just testing first case
testing/og-dhcp-API/pipeline/head There was a failure building this commit Details

nginx_conf
Nicolas Arenas 2024-10-02 11:57:08 +02:00
parent d5258e733a
commit 3ea2296444
1 changed files with 55 additions and 51 deletions

View File

@ -19,63 +19,67 @@ Get Status of the DHCP server
# Convertir la respuesta a JSON usando ${response.json()} # Convertir la respuesta a JSON usando ${response.json()}
${json}= Set Variable ${response.json()} ${json}= Set Variable ${response.json()}
# Validar el estado de los servicios # Validar el estado de los servicios
Should Be Equal ${json["services_status"]["tftpboot"]} active Should Contain ${response.json()} success
Should Be Equal ${json["services_status"]["nginx"]} active Should Contain ${response.json()} message
Should Contain ${response.json()['message']} disk_usage
Should Contain ${response.json()['message']} subnets
Should Contain ${response.json()['message']['disk_usage']} total
Get all subnets
[Documentation] Get all subnets
[Tags] subnets
${response}= GET ${BASE_URL}/subnets
Status Should Be 200
# Convertir la respuesta a JSON usando ${response.json()}
${json}= Set Variable ${response.json()}
# Obtener la longitud del arreglo JSON
${num_elements}= Get Length ${json}
# Validar el número de elementos
Should Be Equal As Numbers ${num_elements} 1
Post a new subnet # Get all subnets
[Documentation] Post a new subnet # [Documentation] Get all subnets
[Tags] subnets # [Tags] subnets
${headers}= Create Dictionary Content-Type=application/json # ${response}= GET ${BASE_URL}/subnets
${response}= POST ${BASE_URL}/subnets json=${new_subnet} headers=${headers} # Status Should Be 200
Status Should Be 200 # # Convertir la respuesta a JSON usando ${response.json()}
${json}= Set Variable ${response.json()} # ${json}= Set Variable ${response.json()}
Should Be Equal ${json["status"]} success # # Obtener la longitud del arreglo JSON
Should Be Equal ${json["message"]} Subred creada correctamente # ${num_elements}= Get Length ${json}
Should Be Equal ${json["subnetId"]} 2 # # Validar el número de elementos
# Should Be Equal As Numbers ${num_elements} 1
Modify a new subnet by id # Post a new subnet
[Documentation] Modify a subnet by id # [Documentation] Post a new subnet
[Tags] subnets # [Tags] subnets
# ${headers}= Create Dictionary Content-Type=application/json
# ${response}= POST ${BASE_URL}/subnets json=${new_subnet} headers=${headers}
# Status Should Be 200
# ${json}= Set Variable ${response.json()}
# Should Be Equal ${json["status"]} success
# Should Be Equal ${json["message"]} Subred creada correctamente
# Should Be Equal ${json["subnetId"]} 2
# Modificar la subred con id=2 # Modify a new subnet by id
${response}= PUT ${BASE_URL}/subnets/2 json=${modified_subnet} headers=${headers} # [Documentation] Modify a subnet by id
Status Should Be 200 # [Tags] subnets
# Verificar la respuesta del PUT # # Modificar la subred con id=2
${json}= Set Variable ${response.json()} # ${response}= PUT ${BASE_URL}/subnets/2 json=${modified_subnet} headers=${headers}
Should Be Equal ${json["status"]} success # Status Should Be 200
Should Be Equal ${json["message"]} Subred modificada correctamente
Should Be Equal ${json["subnetId"]} 2
# Obtener todas las subredes y verificar si la subred fue modificada # # Verificar la respuesta del PUT
${response_all}= GET ${BASE_URL}/subnets # ${json}= Set Variable ${response.json()}
Status Should Be 200 # Should Be Equal ${json["status"]} success
${json_all}= Set Variable ${response_all.json()} # Should Be Equal ${json["message"]} Subred modificada correctamente
# Should Be Equal ${json["subnetId"]} 2
# Iterar sobre todas las subredes para encontrar la subred con id=2 y verificar su máscara # # Obtener todas las subredes y verificar si la subred fue modificada
FOR ${subnet} IN @{json_all} # ${response_all}= GET ${BASE_URL}/subnets
Run Keyword If '${subnet["id"]}' == '2' Should Be Equal ${subnet["mask"]} 255.255.192.0 # Status Should Be 200
END # ${json_all}= Set Variable ${response_all.json()}
Delete a new subnet by id # # Iterar sobre todas las subredes para encontrar la subred con id=2 y verificar su máscara
[Documentation] Delete a subnet by id # FOR ${subnet} IN @{json_all}
[Tags] subnets # Run Keyword If '${subnet["id"]}' == '2' Should Be Equal ${subnet["mask"]} 255.255.192.0
${response}= DELETE ${BASE_URL}/subnets/2 headers=${headers} # END
Status Should Be 200
${json}= Set Variable ${response.json()} # Delete a new subnet by id
Should Be Equal ${json["status"]} success # [Documentation] Delete a subnet by id
Should Be Equal ${json["message"]} Subred eliminada correctamente # [Tags] subnets
Should Be Equal ${json["subnetId"]} 2 # ${response}= DELETE ${BASE_URL}/subnets/2 headers=${headers}
# Status Should Be 200
# ${json}= Set Variable ${response.json()}
# Should Be Equal ${json["status"]} success
# Should Be Equal ${json["message"]} Subred eliminada correctamente
# Should Be Equal ${json["subnetId"]} 2