summaryrefslogtreecommitdiffstats
path: root/tests/api/feeds.bats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/api/feeds.bats')
-rw-r--r--tests/api/feeds.bats48
1 files changed, 46 insertions, 2 deletions
diff --git a/tests/api/feeds.bats b/tests/api/feeds.bats
index 26bdbdbd8..83a47d5ab 100644
--- a/tests/api/feeds.bats
+++ b/tests/api/feeds.bats
@@ -48,11 +48,55 @@ teardown() {
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')
+ ID=$(http --ignore-stdin -b -a ${user}:${user} POST ${BASE_URLv1}/feeds url=$NC_FEED | grep -Po '"id":\K([0-9]+)')
run http --ignore-stdin -b -a ${user}:${user} DELETE ${BASE_URLv1}/feeds/$ID
assert_output --partial "[]"
+}
+
+@test "[$TESTSUITE] Move feed to different folder" {
+ # create folders and store ids
+ FIRST_FOLDER_ID=$(http --ignore-stdin -b -a ${user}:${user} POST ${BASE_URLv1}/folders name=news-${BATS_SUITE_TEST_NUMBER} | grep -Po '"id":\K([0-9]+)')
+ SECCOND_FOLDER_ID=$(http --ignore-stdin -b -a ${user}:${user} POST ${BASE_URLv1}/folders name=news-${BATS_SUITE_TEST_NUMBER} | grep -Po '"id":\K([0-9]+)')
+
+ FEEDID=$(http --ignore-stdin -b -a ${user}:${user} POST ${BASE_URLv1}/feeds url=$NC_FEED folderId=$FIRST_FOLDER_ID | grep -Po '"id":\K([0-9]+)')
+
+ # move feed, returns nothing
+ http --ignore-stdin -b -a ${user}:${user} PUT ${BASE_URLv1}/feeds/$FEEDID/move folderId=$SECCOND_FOLDER_ID
+
+ # run is not working here.
+ output=$(http --ignore-stdin -b -a ${user}:${user} GET ${BASE_URLv1}/feeds | jq '.feeds | .[0].folderId')
+
+ # self reference of feed is used here
+ assert_output "$SECCOND_FOLDER_ID"
+}
+
+@test "[$TESTSUITE] Move feed to root" {
+ # create folder and store id
+ FOLDER_ID=$(http --ignore-stdin -b -a ${user}:${user} POST ${BASE_URLv1}/folders name=news-${BATS_SUITE_TEST_NUMBER} | grep -Po '"id":\K([0-9]+)')
+
+ FEEDID=$(http --ignore-stdin -b -a ${user}:${user} POST ${BASE_URLv1}/feeds url=$NC_FEED folderId=$FOLDER_ID | grep -Po '"id":\K([0-9]+)')
+
+ # move feed, returns nothing
+ http --ignore-stdin -b -a ${user}:${user} PUT ${BASE_URLv1}/feeds/$FEEDID/move folderId=null
+ # run is not working here.
+ output=$(http --ignore-stdin -b -a ${user}:${user} GET ${BASE_URLv1}/feeds | jq '.feeds | .[0].folderId')
+
+ # self reference of feed is used here
+ assert_output null
+}
+
+@test "[$TESTSUITE] Rename feed" {
+ # create folder and store id
+ FEEDID=$(http --ignore-stdin -b -a ${user}:${user} POST ${BASE_URLv1}/feeds url=$NC_FEED | grep -Po '"id":\K([0-9]+)')
+
+ # rename feed, returns nothing
+ http --ignore-stdin -b -a ${user}:${user} PUT ${BASE_URLv1}/feeds/$FEEDID/rename feedTitle="Great Title"
+ # run is not working here.
+ output=$(http --ignore-stdin -b -a ${user}:${user} GET ${BASE_URLv1}/feeds | jq '.feeds | .[0].title')
+
+ # self reference of feed is used here
+ assert_output '"Great Title"'
} \ No newline at end of file