forked from dCache/dcache
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test case for adding and querying labels via rest api
Motivation the test case was missing Result now adding, removing and querying labals will be tested Target: master Requires-notes: no Requires-book: no Request: 10.1 Acked-by: Karen Hoyos
- Loading branch information
1 parent
7b2b3df
commit e576065
Showing
2 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
### upload building file | ||
PUT {{webdav-door}}/building | ||
Authorization: Basic admin dickerelch | ||
Content-Type: application/octet-stream | ||
|
||
< BUILDING.md | ||
|
||
### upload readme file | ||
PUT {{webdav-door}}/readme | ||
Authorization: Basic admin dickerelch | ||
Content-Type: application/octet-stream | ||
|
||
< README.md | ||
|
||
### make sure readme file is there | ||
GET {{frontend-door}}{{endpoint}}{{namespace}}/readme | ||
|
||
### add "firststep" label to building file | ||
# curl -X POST -u admin:dickerelch -H "Accept: application/json" -H "Content-Type: application/json" {{frontend-door}}{{endpoint}}{{namespace}}/building -d '{"action" : "set-label", "label" : "firststep" }' | ||
POST {{frontend-door}}{{endpoint}}{{namespace}}/building | ||
Authorization: Basic admin dickerelch | ||
Accept: application/json | ||
Content-Type: application/json | ||
|
||
{"action" : "set-label", "label" : "firststep" } | ||
|
||
### add "blue" label to readme file | ||
POST {{frontend-door}}{{endpoint}}{{namespace}}/readme | ||
Authorization: Basic admin dickerelch | ||
Accept: application/json | ||
Content-Type: application/json | ||
|
||
{"action" : "set-label", "label" : "blue" } | ||
|
||
### add "firststep" label to readme file | ||
POST {{frontend-door}}{{endpoint}}{{namespace}}/readme | ||
Authorization: Basic admin dickerelch | ||
Accept: application/json | ||
Content-Type: application/json | ||
|
||
{"action" : "set-label", "label" : "firststep" } | ||
|
||
|
||
### get file(s) that has "firststep" label | ||
GET {{frontend-door}}{{endpoint}}{{labels}}/firststep | ||
|
||
|
||
### get file(s) that has "blue" label | ||
GET {{frontend-door}}{{endpoint}}{{labels}}/blue | ||
|
||
### make sure "firststep" label is there | ||
GET {{frontend-door}}{{endpoint}}{{namespace}}/building/?labels=true | ||
|
||
### make sure "blue" and "firststep" label is there | ||
GET {{frontend-door}}{{endpoint}}{{namespace}}/readme/?labels=true | ||
|
||
> {% | ||
client.test("Response file name is", function () { | ||
|
||
var label1 = response.body["labels"] | ||
|
||
client.log("Response filename 1: " + label1); | ||
|
||
client.assert(label1[0] === "firststep", | ||
"Expected 'label' to have value 'firststep' but received '" + label1 + "'"); | ||
|
||
}); | ||
|
||
%} | ||
|
||
### remove "blue" label | ||
POST {{frontend-door}}{{endpoint}}{{namespace}}/readme | ||
Authorization: Basic admin dickerelch | ||
Accept: application/json | ||
Content-Type: application/json | ||
|
||
{"action" : "rm-label", "label" : "blue" } | ||
|
||
### make sure "blue" label is NOT in readme file | ||
GET {{frontend-door}}{{endpoint}}{{namespace}}/readme/?labels=true | ||
|
||
> {% | ||
client.test("Response file name is", function () { | ||
|
||
var label1 = response.body["labels"] | ||
|
||
client.log("Response filename 1: " + label1); | ||
|
||
client.assert(label1[1] !== null, | ||
"Expected 'label blue' to have value != null, but received '" + label1 + "'"); | ||
|
||
}); | ||
|
||
%} | ||
|
||
|
||
### get file(s) name that has "firststep" label | ||
#Traversing the response | ||
GET {{frontend-door}}{{endpoint}}{{labels}}/firststep | ||
|
||
> {% | ||
client.test("Response file name is", function() { | ||
|
||
var fileName1 = response.body["children"][0]["fileName"]; | ||
var fileName2 = response.body["children"][1]["fileName"]; | ||
|
||
|
||
client.log("Response filename 1: " + fileName1); | ||
client.log("Response filename 1: " + fileName2); | ||
|
||
client.assert(fileName1 === "building-0", "Expected 'fileName' to have value 'building-0' but received '" + fileName1 + "'"); | ||
client.assert(fileName2 === "readme-0", "Expected 'fileName' to have value 'readme-0' but received '" + fileName2 + "'"); | ||
|
||
}); | ||
|
||
|
||
%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters