Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 84a4deff authored by Frederico SEQUEIRA's avatar Frederico SEQUEIRA
Browse files

:white_check_mark: Add new test, remove variables and use variables file

parent 9f80f94b
No related branches found
No related tags found
5 merge requests!133Draft: Rebase v4 firewall,!131Draft: Rebase v4.1,!129Draft: Rebase v4,!126Develop,!124✅ Add Robot testing to Mac Address
......@@ -3,20 +3,19 @@ Test Tags Docs
Library RequestsLibrary
Library OperatingSystem
Library Collections
Variables ../variables.yaml
*** Variables ***
${HOST} 172.19.0.5
${PORT} 8080
${BASE_URL} http://${HOST}:${PORT}
${MAC_ENDPOINT} /api/plugins/mac-address/macaddress/
${VLAN_ENDPOINT} /api/ipam/vlans/
${VLANGROUP_ENDPOINT} /api/ipam/vlan-groups/
${B_TOKEN} Token only4testingpurpose
${TOKEN} Token ${API_TOKEN}
*** Test Cases ***
Create VLAN for testing
${HEADERS} Create Dictionary Content-Type application/json Authorization ${B_TOKEN}
${HEADERS} Create Dictionary Content-Type ${CONTENT_TYPE} Authorization ${TOKEN}
${payload} Create Dictionary name robottest_vlan vid 2
${response}= POST ${BASE_URL}${VLAN_ENDPOINT} json=${payload} headers=${HEADERS} expected_status=201
${json} Set Variable ${response.json()}
......@@ -26,7 +25,7 @@ Create VLAN for testing
Create VLAN Group for testing
${HEADERS} Create Dictionary Content-Type application/json Authorization ${B_TOKEN}
${HEADERS} Create Dictionary Content-Type ${CONTENT_TYPE} Authorization ${TOKEN}
${payload} Create Dictionary name robottest_vlan_group slug slug_test
${response}= POST ${BASE_URL}${VLANGROUP_ENDPOINT} json=${payload} headers=${HEADERS} expected_status=201
${json} Set Variable ${response.json()}
......@@ -35,29 +34,37 @@ Create VLAN Group for testing
Set Global Variable ${VLANGROUP_ID}
Create Mac address assigned to VLAN
${HEADERS} Create Dictionary Content-Type application/json Authorization ${B_TOKEN}
${HEADERS} Create Dictionary Content-Type ${CONTENT_TYPE} Authorization ${TOKEN}
${payload} Create Dictionary mac_address 90:B0:E9:53:91:EF status active end_date 2024-10-30 description robot_testing assigned_object_id ${VLAN_ID} assigned_object_type vlan
${response}= POST ${BASE_URL}${MAC_ENDPOINT} json=${payload} headers=${HEADERS} expected_status=201
${json} Set Variable ${response.json()}
Convert to Dictionary ${json}
${MACADDRESS_ID}= Get From Dictionary ${json} id
Set Global Variable ${MACADDRESS_ID}
${MACADDRESS_VLAN_ID}= Get From Dictionary ${json} id
Set Global Variable ${MACADDRESS_VLAN_ID}
Create Test Unique Mac address constraint
${HEADERS} Create Dictionary Content-Type application/json Authorization ${B_TOKEN}
${HEADERS} Create Dictionary Content-Type ${CONTENT_TYPE} Authorization ${TOKEN}
${payload} Create Dictionary mac_address 90:B0:E9:53:91:EF status active end_date 2024-10-30 description robot_testing_vlan assigned_object_id 1 assigned_object_type vlan
${response}= POST ${BASE_URL}${MAC_ENDPOINT} json=${payload} headers=${HEADERS} expected_status=400
Create Mac address assigned to VLAN Group
${HEADERS} Create Dictionary Content-Type application/json Authorization ${B_TOKEN}
${HEADERS} Create Dictionary Content-Type ${CONTENT_TYPE} Authorization ${TOKEN}
${payload} Create Dictionary mac_address 90:B0:E9:53:92:EF status active end_date 2024-10-30 description robot_testing_vlan_group assigned_object_id ${VLANGROUP_ID} assigned_object_type vlangroup
${response}= POST ${BASE_URL}${MAC_ENDPOINT} json=${payload} headers=${HEADERS} expected_status=201
${json} Set Variable ${response.json()}
Convert to Dictionary ${json}
${MACADDRESS_VLANGROUP_ID}= Get From Dictionary ${json} id
Set Global Variable ${MACADDRESS_VLANGROUP_ID}
Create Mac address assigned to wrong Object
${HEADERS} Create Dictionary Content-Type application/json Authorization ${B_TOKEN}
${HEADERS} Create Dictionary Content-Type ${CONTENT_TYPE} Authorization ${TOKEN}
${payload} Create Dictionary mac_address 90:B0:E9:53:93:EF status active end_date 2024-10-30 description robot_testing_vlan_group assigned_object_id 1 assigned_object_type wrong_obj
${response}= POST ${BASE_URL}${MAC_ENDPOINT} json=${payload} headers=${HEADERS} expected_status=400
Create Test Delete Mac Address assigned to VLAN
${HEADERS} Create Dictionary Content-Type application/json Authorization ${B_TOKEN}
${response}= DELETE ${BASE_URL}${MAC_ENDPOINT}${MACADDRESS_ID} headers=${HEADERS} expected_status=204
Delete Mac Address assigned to VLAN
${HEADERS} Create Dictionary Content-Type ${CONTENT_TYPE} Authorization ${TOKEN}
${response}= DELETE ${BASE_URL}${MAC_ENDPOINT}${MACADDRESS_VLAN_ID} headers=${HEADERS} expected_status=204
Delete Mac Address assigned to VLAN Group
${HEADERS} Create Dictionary Content-Type ${CONTENT_TYPE} Authorization ${TOKEN}
${response}= DELETE ${BASE_URL}${MAC_ENDPOINT}${MACADDRESS_VLANGROUP_ID} headers=${HEADERS} expected_status=204
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment