Updating test cases
testing/og-dhcp-API/pipeline/head There was a failure building this commit
Details
testing/og-dhcp-API/pipeline/head There was a failure building this commit
Details
parent
7ac1d486fd
commit
2d391cdd34
|
|
@ -14,72 +14,103 @@ ${modified_subnet} Create Dictionary mask=255.255.192.0 address=192.1
|
||||||
Get Status of the DHCP server
|
Get Status of the DHCP server
|
||||||
[Documentation] Get status of the dhcp server and check services status
|
[Documentation] Get status of the dhcp server and check services status
|
||||||
[Tags] status
|
[Tags] status
|
||||||
${response}= GET ${BASE_URL}/status
|
${response}= GET ${BASE_URL}/status
|
||||||
Status Should Be 200
|
Status Should Be 200 ${response}
|
||||||
# Convertir la respuesta a JSON usando ${response.json()}
|
# Convertir la respuesta a JSON usando ${response.json()}
|
||||||
${json}= Set Variable ${response.json()}
|
${json}= Convert to Dictionary ${response.json()}
|
||||||
# Validar el estado de los servicios
|
Dictionary Should Contain Key ${json} success
|
||||||
Should Contain ${response.json()} success
|
Dictionary Should Contain Key ${json} message
|
||||||
Should Contain ${response.json()} message
|
|
||||||
Should Contain ${response.json()['message']} disk_usage
|
Should Contain ${response.json()['message']} disk_usage
|
||||||
Should Contain ${response.json()['message']} subnets
|
Should Contain ${response.json()['message']} subnets
|
||||||
Should Contain ${response.json()['message']['disk_usage']} total
|
Should Contain ${response.json()['message']['disk_usage']} total
|
||||||
|
|
||||||
|
|
||||||
# Get all subnets
|
Get all subnets
|
||||||
# [Documentation] Get all subnets
|
[Documentation] Get all subnets
|
||||||
# [Tags] subnets
|
[Tags] subnets
|
||||||
# ${response}= GET ${BASE_URL}/subnets
|
${response}= GET ${BASE_URL}/subnets
|
||||||
# Status Should Be 200
|
Status Should Be 200 ${response}
|
||||||
# # Convertir la respuesta a JSON usando ${response.json()}
|
# Convertir la respuesta a JSON usando ${response.json()}
|
||||||
# ${json}= Set Variable ${response.json()}
|
${json}= Convert to Dictionary ${response.json()}
|
||||||
# # Obtener la longitud del arreglo JSON
|
Dictionary Should Contain Key ${json} success
|
||||||
# ${num_elements}= Get Length ${json}
|
Dictionary Should Contain Key ${json} message
|
||||||
# # Validar el número de elementos
|
${subnets}= Set Variable False
|
||||||
# Should Be Equal As Numbers ${num_elements} 1
|
FOR ${subred} IN @{json_response['message']}
|
||||||
|
Run Keyword If '${subred['id']}' == '1' Set Variable ${subred_encontrada} True
|
||||||
|
END
|
||||||
|
Should Be True ${subred_encontrada}
|
||||||
|
|
||||||
# Post a new subnet
|
|
||||||
# [Documentation] Post a new subnet
|
|
||||||
# [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
|
|
||||||
|
|
||||||
# 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
|
||||||
# # Modificar la subred con id=2
|
${response}= POST ${BASE_URL}/subnets json=${new_subnet} headers=${headers} expected_status=200
|
||||||
# ${response}= PUT ${BASE_URL}/subnets/2 json=${modified_subnet} headers=${headers}
|
Status Should Be 200 ${response}
|
||||||
# Status Should Be 200
|
${json}= Convert to Dictionary ${response.json()}
|
||||||
|
Dictionary Should Contain Key ${json} success
|
||||||
# # Verificar la respuesta del PUT
|
Dictionary Should Contain Key ${json} message
|
||||||
# ${json}= Set Variable ${response.json()}
|
Should Contain ${json["success"]} Subnet agregada correctamente
|
||||||
# Should Be Equal ${json["status"]} success
|
Should Be Equal As Numbers ${json["message"]["id"]} 2
|
||||||
# Should Be Equal ${json["message"]} Subred modificada correctamente
|
Should Be Equal ${json["message"]["mask"]} ${new_subnet["mask"]}
|
||||||
# Should Be Equal ${json["subnetId"]} 2
|
Should Be Equal ${json["message"]["address"]} ${new_subnet["address"]}
|
||||||
|
Should Be Equal ${json["message"]["nextServer"]} ${new_subnet["nextServer"]}
|
||||||
# # Obtener todas las subredes y verificar si la subred fue modificada
|
Should Be Equal ${json["message"]["bootFileName"]} ${new_subnet["bootFileName"]}
|
||||||
# ${response_all}= GET ${BASE_URL}/subnets
|
|
||||||
# Status Should Be 200
|
|
||||||
# ${json_all}= Set Variable ${response_all.json()}
|
|
||||||
|
|
||||||
# # Iterar sobre todas las subredes para encontrar la subred con id=2 y verificar su máscara
|
|
||||||
# FOR ${subnet} IN @{json_all}
|
|
||||||
# Run Keyword If '${subnet["id"]}' == '2' Should Be Equal ${subnet["mask"]} 255.255.192.0
|
|
||||||
# END
|
|
||||||
|
|
||||||
# Delete a new subnet by id
|
Post a new subnet with existing id
|
||||||
# [Documentation] Delete a subnet by id
|
[Documentation] Post a new subnet with invalid data
|
||||||
# [Tags] subnets
|
[Tags] subnets
|
||||||
# ${response}= DELETE ${BASE_URL}/subnets/2 headers=${headers}
|
${headers}= Create Dictionary Content-Type=application/json
|
||||||
# Status Should Be 200
|
${response}= POST ${BASE_URL}/subnets json=${new_subnet} headers=${headers} expected_status=400
|
||||||
# ${json}= Set Variable ${response.json()}
|
Status Should Be 400 ${response}
|
||||||
# Should Be Equal ${json["status"]} success
|
${json}= Convert to Dictionary ${response.json()}
|
||||||
# Should Be Equal ${json["message"]} Subred eliminada correctamente
|
Dictionary Should Contain Key ${json} error
|
||||||
# Should Be Equal ${json["subnetId"]} 2
|
Should Contain ${response.json()['error']} Subnet con id 2 ya existe
|
||||||
|
|
||||||
|
|
||||||
|
Post a new subnet with existing address
|
||||||
|
[Documentation] Post a new subnet with invalid data
|
||||||
|
[Tags] subnets
|
||||||
|
${headers}= Create Dictionary Content-Type=application/json
|
||||||
|
${new_subnet_invalid}= Create Dictionary subnetId=3 mask=255.255.255.0 address=192.168.1.0 nextServer=192.168.1.1 bootFileName=pxelinux.0
|
||||||
|
${response}= POST ${BASE_URL}/subnets json=${new_subnet_invalid} headers=${headers} expected_status=400
|
||||||
|
Status Should Be 400 ${response}
|
||||||
|
${json}= Convert to Dictionary ${response.json()}
|
||||||
|
Dictionary Should Contain Key ${json} error
|
||||||
|
Should Contain ${response.json()['error']} Error: La subred el subnet '192.168.1.0/24' ya existe en las subredes
|
||||||
|
|
||||||
|
|
||||||
|
Modify an existing subnet by id
|
||||||
|
[Documentation] Modify a subnet by id
|
||||||
|
[Tags] subnets
|
||||||
|
|
||||||
|
# Modificar la subred con id=2
|
||||||
|
${response}= PUT ${BASE_URL}/subnets/2 json=${modified_subnet} headers=${headers} expected_status=200
|
||||||
|
Status Should Be 200
|
||||||
|
|
||||||
|
# Verificar la respuesta del PUT
|
||||||
|
${json}= Set Variable ${response.json()}
|
||||||
|
Should Be Equal ${json["status"]} success
|
||||||
|
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
|
||||||
|
${response_all}= GET ${BASE_URL}/subnets
|
||||||
|
Status Should Be 200
|
||||||
|
${json_all}= Set Variable ${response_all.json()}
|
||||||
|
|
||||||
|
# Iterar sobre todas las subredes para encontrar la subred con id=2 y verificar su máscara
|
||||||
|
FOR ${subnet} IN @{json_all}
|
||||||
|
Run Keyword If '${subnet["id"]}' == '2' Should Be Equal ${subnet["mask"]} 255.255.192.0
|
||||||
|
END
|
||||||
|
|
||||||
|
Delete a new subnet by id
|
||||||
|
[Documentation] Delete a subnet by id
|
||||||
|
[Tags] subnets
|
||||||
|
${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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue