From 5553b8f12b12c93549f5c941bcc3dfef4b347d9d Mon Sep 17 00:00:00 2001 From: Benjamin Brahmer Date: Thu, 17 Mar 2022 18:17:42 +0100 Subject: move feed test and rename feed Signed-off-by: Benjamin Brahmer --- tests/api/feeds.bats | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file 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 -- cgit v1.2.3