diff options
author | zhangguanzhang <zhangguanzhang@qq.com> | 2020-08-09 22:05:26 +0800 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2020-08-20 12:16:52 -0400 |
commit | 09bd563e2bc544aa987e90c5d831f146198eebb5 (patch) | |
tree | f551c06e19fbc8e2136bafc43c119fb8b9946633 /test/apiv2 | |
parent | c22ea20bf6f12ccf289a48cc185d5159ce7fdaf4 (diff) | |
download | podman-09bd563e2bc544aa987e90c5d831f146198eebb5.tar.gz podman-09bd563e2bc544aa987e90c5d831f146198eebb5.tar.bz2 podman-09bd563e2bc544aa987e90c5d831f146198eebb5.zip |
Add parameter verification for api creation network
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
Diffstat (limited to 'test/apiv2')
-rw-r--r-- | test/apiv2/35-networks.at | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/test/apiv2/35-networks.at b/test/apiv2/35-networks.at index fff3f3b1f..4c032c072 100644 --- a/test/apiv2/35-networks.at +++ b/test/apiv2/35-networks.at @@ -3,6 +3,32 @@ # network-related tests # -t GET /networks/non-existing-network 404 +t GET networks/non-existing-network 404 \ + .cause='network not found' + +if root; then + t POST libpod/networks/create?name=network1 '' 200 \ + .Filename~.*/network1\\.conflist + + # --data '{"Subnet":{"IP":"10.10.254.0","Mask":[255,255,255,0]}}' + t POST libpod/networks/create?name=network2 '"Subnet":{"IP":"10.10.254.0","Mask":[255,255,255,0]}' 200 \ + .Filename~.*/network2\\.conflist + + # test for empty mask + t POST libpod/networks/create '"Subnet":{"IP":"10.10.1.0","Mask":[]}' 500 \ + .cause~'.*cannot be empty' + # test for invalid mask + t POST libpod/networks/create '"Subnet":{"IP":"10.10.1.0","Mask":[0,255,255,0]}' 500 \ + .cause~'.*mask is invalid' + + # clean the network + t DELETE libpod/networks/network1 200 \ + .[0].Name~network1 \ + .[0].Err=null + t DELETE libpod/networks/network2 200 \ + .[0].Name~network2 \ + .[0].Err=null + +fi # vim: filetype=sh |