Skip to content

Commit

Permalink
Merge pull request #901 from cherrycl/issue-900
Browse files Browse the repository at this point in the history
fix: Update tests to allow empty profile and empty protocol when creating device
  • Loading branch information
cloudxxx8 authored Jul 3, 2024
2 parents dc83cd1 + e2fe80b commit 4168d22
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,6 @@ ErrDevicePATCH005 - Update device with serviceName validate error
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Multiple Devices Sample And Profiles Sample

ErrDevicePATCH006 - Update device with profileName validate error
# Empty profileName
Given Create Devices And Generate Multiple Devices Sample For Updating Data
And Set To Dictionary ${Device}[1][device] profileName=${EMPTY}
When Update Devices ${Device}
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Multiple Devices Sample And Profiles Sample

ErrDevicePATCH007 - Update device with protocols validate error
# Empty protocols
Given Create Devices And Generate Multiple Devices Sample For Updating Data
And Set To Dictionary ${Device}[2][device] protocols=&{EMPTY}
When Update Devices ${Device}
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Multiple Devices Sample And Profiles Sample

ErrDevicePATCH008 - Update device with adminState value validate error
# Out of optional value for adminState
Given Create Devices And Generate Multiple Devices Sample For Updating Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,26 @@ DevicePATCH002 - Update device with device service and profile
And Device Profile/Device Should Be Updated
[Teardown] Delete Multiple Devices Sample And Profiles Sample

DevicePATCH003 - Update device with empty protocol
Given Create Devices And Generate Multiple Devices Sample For Updating Data
And Set To Dictionary ${Device}[2][device] protocols=&{EMPTY}
When Update Devices ${Device}
Then Should Return Status Code "207"
And Item Index All Should Contain Status Code "200"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Multiple Devices Sample And Profiles Sample

DevicePATCH004 - Update device with empty profileName
Given Create Devices And Generate Multiple Devices Sample For Updating Data
And Set To Dictionary ${Device}[1][device] profileName=${EMPTY}
When Update Devices ${Device}
Then Should Return Status Code "207"
And Item Index All Should Contain Status Code "200"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Multiple Devices Sample And Profiles Sample

*** Keywords ***
Device ${type} Should Be Updated
${list}= Create List Test-Device Test-Device-Locked Test-Device-Disabled Test-Device-AutoEvents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,28 +68,6 @@ ErrDevicePOST005 - Create device with serviceName validate error
[Teardown] Delete multiple device profiles by names
... Test-Profile-1 Test-Profile-2 Test-Profile-3

ErrDevicePOST006 - Create device with profileName validate error
# Empty profileName
Given Create Multiple Profiles And Generate Multiple Devices Sample
And Set To Dictionary ${Device}[1][device] profileName=${EMPTY}
When Create Device With ${Device}
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete multiple device profiles by names
... Test-Profile-1 Test-Profile-2 Test-Profile-3

ErrDevicePOST007 - Create device with protocols validate error
# Empty protocols
Given Create Multiple Profiles And Generate Multiple Devices Sample
And Set To Dictionary ${Device}[1][device] protocols=&{EMPTY}
When Create Device With ${Device}
Then Should Return Status Code "400"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete multiple device profiles by names
... Test-Profile-1 Test-Profile-2 Test-Profile-3

ErrDevicePOST008 - Create device with adminState value validate error
# Out of optional value for adminState
Given Create Multiple Profiles And Generate Multiple Devices Sample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,23 @@ DevicePOST004 - Create device with Chinese naming
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Run Keywords Delete device by name ${test_device_name}
... AND Delete device profile by name ${test_profile_name}

DevicePOST005 - Create device with empty profileName
Given Create Multiple Profiles And Generate Multiple Devices Sample
And Set To Dictionary ${Device}[1][device] profileName=${EMPTY}
When Create Device With ${Device}
Then Should Return Status Code "207"
And Item Index All Should Contain Status Code "201" And id
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Multiple Devices Sample And Profiles Sample

DevicePOST006 - Create device with empty protocol
Given Create Multiple Profiles And Generate Multiple Devices Sample
And Set To Dictionary ${Device}[2][device] protocols=&{EMPTY}
When Create Device With ${Device}
Then Should Return Status Code "207"
And Item Index All Should Contain Status Code "201" And id
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Multiple Devices Sample And Profiles Sample

0 comments on commit 4168d22

Please sign in to comment.