Fix all subnets test
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
Prepares error for all subnetsnginx_conf
parent
2a88fd7dc6
commit
98319e3718
|
@ -4,6 +4,7 @@ Library Collections
|
|||
Library RequestsLibrary
|
||||
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${BASE_URL} http://localhost:8005/ogdhcp/v1
|
||||
${headers} Create Dictionary Content-Type application/json
|
||||
|
@ -32,26 +33,41 @@ Get Status of the DHCP server
|
|||
|
||||
|
||||
Get All Subnets
|
||||
[Documentation] Obtener todas las subredes.
|
||||
[Documentation] Este test verifica que la API retorna las subredes correctamente con el código 200.
|
||||
[Tags] subnets
|
||||
${response}= GET ${BASE_URL}/subnets
|
||||
|
||||
${response}= GET ${BASE_URL}/ogdhcp/v1/subnets
|
||||
# Verificar código de estado HTTP
|
||||
Should Be Equal As Numbers ${response.status_code} 200
|
||||
|
||||
${json}= ${response.json()}
|
||||
|
||||
# Verificar que la respuesta es una lista
|
||||
Should Be True ${json} is list
|
||||
|
||||
# Verificar que al menos una subred está presente
|
||||
Should Not Be Empty ${json}
|
||||
|
||||
# Validar que la primera subred tiene ciertos campos
|
||||
Dictionary Should Contain Key ${json[0]} id
|
||||
Dictionary Should Contain Key ${json[0]} subnet
|
||||
|
||||
${json}= Convert To Dictionary ${response.json()}
|
||||
# Verificar que la respuesta contiene las claves 'success' y 'message'
|
||||
Dictionary Should Contain Key ${json} success
|
||||
Dictionary Should Contain Key ${json} message
|
||||
# Validar el mensaje de éxito
|
||||
Should Be Equal ${json['success']} Subredes obtenidas correctamente
|
||||
# Verificar que 'message' es una lista
|
||||
Should Be True ${json['message']} is list
|
||||
# Verificar que cada subred en 'message' tiene los campos esperados
|
||||
FOR ${subred} IN @{json['message']}
|
||||
Dictionary Should Contain Key ${subred} id
|
||||
Dictionary Should Contain Key ${subred} ip-address
|
||||
Dictionary Should Contain Key ${subred} hw-address
|
||||
Dictionary Should Contain Key ${subred} hostname
|
||||
END
|
||||
|
||||
## Revisar como forzar el error
|
||||
# Get All subnets error
|
||||
# [Documentation] Este test verifica que la API retorna un error correctamente con el código 400.
|
||||
# [Tags] subnets
|
||||
# ${response}= GET ${BASE_URL}/ogdhcp/v1/subnets params=${{"invalid_param": "value"}} expected_status=400 # Modificar para provocar el error
|
||||
# # Verificar código de estado HTTP
|
||||
# Should Be Equal As Numbers ${response.status_code} 400
|
||||
# ${json}= Convert To Dictionary ${response.json()}
|
||||
|
||||
# # Verificar que la respuesta contiene la clave 'error'
|
||||
# Dictionary Should Contain Key ${json} error
|
||||
|
||||
# # Validar que el mensaje de error no está vacío
|
||||
# Should Not Be Empty ${json['error']}
|
||||
|
||||
Post a new subnet
|
||||
[Documentation] Post a new subnet
|
||||
|
|
Loading…
Reference in New Issue