diff options
author | Benjamin Brahmer <info@b-brahmer.de> | 2022-03-17 18:17:42 +0100 |
---|---|---|
committer | Benjamin Brahmer <info@b-brahmer.de> | 2022-05-03 21:27:48 +0200 |
commit | 5553b8f12b12c93549f5c941bcc3dfef4b347d9d (patch) | |
tree | 4d007cef4fca41b795cd77fe6bb8e8c29e76bd33 | |
parent | c2ee34baa53d24865fa2df3ebf9c6021201e5974 (diff) |
move feed test and rename feed
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
-rw-r--r-- | tests/api/feeds.bats | 48 |
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 |