summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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')