summaryrefslogtreecommitdiff
path: root/test/apiv2/30-volumes.at
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2021-03-01 10:47:48 -0700
committerEd Santiago <santiago@redhat.com>2021-03-01 10:47:48 -0700
commit9435e5b79b3dacca61118b159b06fa38cb1ac0d8 (patch)
treeeafcb8c6d135034402c0d8f7e57c583ea39fb98c /test/apiv2/30-volumes.at
parentb5827d80d39f2a9865d7f6486d63e61d5c9926ef (diff)
downloadpodman-9435e5b79b3dacca61118b159b06fa38cb1ac0d8.tar.gz
podman-9435e5b79b3dacca61118b159b06fa38cb1ac0d8.tar.bz2
podman-9435e5b79b3dacca61118b159b06fa38cb1ac0d8.zip
APIv2 tests: make more maintainable
While I wasn't looking, some completely unreadable cruft crept in here, and it's totally my fault: I never knew you could pass JSON to a GET query. Everyone who DID know that, did so, but had to URL-escape it into a completely gobbledygook mess to make curl happy. Solution: trivial, do the URL-escaping in 't' itself. I just never realized that was needed. I'm so sorry. I hope this helps. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/apiv2/30-volumes.at')
-rw-r--r--test/apiv2/30-volumes.at35
1 files changed, 15 insertions, 20 deletions
diff --git a/test/apiv2/30-volumes.at b/test/apiv2/30-volumes.at
index b38810039..cf4b3d3ea 100644
--- a/test/apiv2/30-volumes.at
+++ b/test/apiv2/30-volumes.at
@@ -45,18 +45,17 @@ t GET libpod/volumes/json 200 \
.[0].Name~.* \
.[0].Mountpoint~.* \
.[0].CreatedAt~[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}.*
-# -G --data-urlencode 'filters={"name":["foo1"]}'
-t GET libpod/volumes/json?filters=%7B%22name%22%3A%5B%22foo1%22%5D%7D 200 length=1 .[0].Name=foo1
-# -G --data-urlencode 'filters={"name":["foo1","foo2"]}'
-t GET libpod/volumes/json?filters=%7B%22name%22%3A%20%5B%22foo1%22%2C%20%22foo2%22%5D%7D 200 length=2 .[0].Name=foo1 .[1].Name=foo2
-# -G --data-urlencode 'filters={"name":["nonexistent"]}'
-t GET libpod/volumes/json?filters=%7B%22name%22%3A%5B%22nonexistent%22%5D%7D 200 length=0
-# -G --data-urlencode 'filters={"label":["testlabel"]}'
-t GET libpod/volumes/json?filters=%7B%22label%22:%5B%22testlabel%22%5D%7D 200 length=2
-# -G --data-urlencode 'filters={"label":["testlabel=testonly"]}'
-t GET libpod/volumes/json?filters=%7B%22label%22:%5B%22testlabel=testonly%22%5D%7D 200 length=1
-# -G --data-urlencode 'filters={"label":["testlabel1=testonly"]}'
-t GET libpod/volumes/json?filters=%7B%22label%22:%5B%22testlabel1=testonly%22%5D%7D 200 length=1
+t GET libpod/volumes/json?filters='{"name":["foo1"]}' 200 \
+ length=1 \
+ .[0].Name=foo1
+t GET libpod/volumes/json?filters='{"name":%20["foo1",%20"foo2"]}' 200 \
+ length=2 \
+ .[0].Name=foo1 \
+ .[1].Name=foo2
+t GET libpod/volumes/json?filters='{"name":["nonexistent"]}' 200 length=0
+t GET libpod/volumes/json?filters='{"label":["testlabel"]}' 200 length=2
+t GET libpod/volumes/json?filters='{"label":["testlabel=testonly"]}' 200 length=1
+t GET libpod/volumes/json?filters='{"label":["testlabel1=testonly"]}' 200 length=1
## inspect volume
t GET libpod/volumes/foo1/json 200 \
@@ -79,16 +78,12 @@ t DELETE libpod/volumes/foo1 404 \
.response=404
## Prune volumes with label matching 'testlabel1=testonly'
-# -G --data-urlencode 'filters={"label":["testlabel1=testonly"]}'
-t POST libpod/volumes/prune?filters=%7B%22label%22:%5B%22testlabel1=testonly%22%5D%7D "" 200
-# -G --data-urlencode 'filters={"label":["testlabel1=testonly"]}'
-t GET libpod/volumes/json?filters=%7B%22label%22:%5B%22testlabel1=testonly%22%5D%7D 200 length=0
+t POST libpod/volumes/prune?filters='{"label":["testlabel1=testonly"]}' "" 200
+t GET libpod/volumes/json?filters='{"label":["testlabel1=testonly"]}' 200 length=0
## Prune volumes with label matching 'testlabel'
-# -G --data-urlencode 'filters={"label":["testlabel"]}'
-t POST libpod/volumes/prune?filters=%7B%22label%22:%5B%22testlabel%22%5D%7D "" 200
-# -G --data-urlencode 'filters={"label":["testlabel"]}'
-t GET libpod/volumes/json?filters=%7B%22label%22:%5B%22testlabel%22%5D%7D 200 length=0
+t POST libpod/volumes/prune?filters='{"label":["testlabel"]}' "" 200
+t GET libpod/volumes/json?filters='{"label":["testlabel"]}' 200 length=0
## Prune volumes
t POST libpod/volumes/prune "" 200