summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Brahmer <info@b-brahmer.de>2022-03-16 20:44:34 +0100
committerBenjamin Brahmer <info@b-brahmer.de>2022-05-03 21:27:48 +0200
commitc2ee34baa53d24865fa2df3ebf9c6021201e5974 (patch)
tree3e17f9c6aa69f15adb6b9bd2db1b4543fbd20195
parent1e17e67c143386840b303a5382db193b6df81525 (diff)
create feed inside of folder
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
-rw-r--r--tests/api/feeds.bats25
1 files changed, 22 insertions, 3 deletions
diff --git a/tests/api/feeds.bats b/tests/api/feeds.bats
index 9b175df81..26bdbdbd8 100644
--- a/tests/api/feeds.bats
+++ b/tests/api/feeds.bats
@@ -9,10 +9,17 @@ setup() {
TESTSUITE="Feeds"
teardown() {
+ # delete all feeds
ID=$(http --ignore-stdin -b -a ${user}:${user} GET ${BASE_URLv1}/feeds | grep -Po '"id":\K([0-9]+)' | tr '\n' ' ')
for i in $ID; do
http --ignore-stdin -b -a ${user}:${user} DELETE ${BASE_URLv1}/feeds/$i
done
+
+ # delete all folders
+ ID=$(http --ignore-stdin -b -a ${user}:${user} GET ${BASE_URLv1}/folders | grep -Po '"id":\K([0-9]+)' | tr '\n' ' ')
+ for i in $ID; do
+ http --ignore-stdin -b -a ${user}:${user} DELETE ${BASE_URLv1}/folders/$i
+ done
}
@test "[$TESTSUITE] Read empty" {
@@ -23,13 +30,25 @@ teardown() {
}
@test "[$TESTSUITE] Create new" {
- # $() is needed in this case otherwise bats fails to fetch the output...
- run $(http --ignore-stdin -b -a ${user}:${user} POST ${BASE_URLv1}/feeds url=$NC_FEED | jq '.feeds | .[0].url')
+ # run is not working here.
+ output=$(http --ignore-stdin -b -a ${user}:${user} POST ${BASE_URLv1}/feeds url=$NC_FEED | jq '.feeds | .[0].url')
# self reference of feed is used here
- assert_output --partial "https://nextcloud.com/blog/feed/"
+ assert_output '"https://nextcloud.com/blog/feed/"'
}
+@test "[$TESTSUITE] Create new inside folder" {
+ # create folder and store id
+ ID=$(http --ignore-stdin -b -a ${user}:${user} POST ${BASE_URLv1}/folders name=news-${BATS_SUITE_TEST_NUMBER} | grep -Po '"id":\K([0-9]+)')
+
+ # run is not working here.
+ output=$(http --ignore-stdin -b -a ${user}:${user} POST ${BASE_URLv1}/feeds url=$NC_FEED folderId=$ID | jq '.feeds | .[0].folderId')
+
+ # self reference of feed is used here
+ assert_output "$ID"
+}
+
+
@test "[$TESTSUITE] Delete one" {
ID=$(http --ignore-stdin -b -a ${user}:${user} POST ${BASE_URLv1}/feeds url=$NC_FEED | jq '.feeds | .[0].id')