diff options
author | Benjamin Brahmer <info@b-brahmer.de> | 2022-12-02 06:43:52 +0100 |
---|---|---|
committer | Benjamin Brahmer <info@b-brahmer.de> | 2023-01-29 19:25:35 +0100 |
commit | c2f42f8c1137ae4b11ad23d5279c8000a0a5cfe4 (patch) | |
tree | a58a01bc834c2774c17a51667602bb3c4cd21997 | |
parent | ac17f8b41a7386bb9eedeb2c7a4af36fbc468412 (diff) |
add first half of next test
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
-rw-r--r-- | tests/updater/update.bats | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/updater/update.bats b/tests/updater/update.bats index 85129e232..e9820eb92 100644 --- a/tests/updater/update.bats +++ b/tests/updater/update.bats @@ -119,6 +119,8 @@ teardown() { assert_equal $STATUS_CODE 200 # check if amount is as expected assert_equal "${#ID_LIST2[@]}" 200 + + # unread items should be empty assert_output "" } @@ -152,4 +154,30 @@ teardown() { # check if amount is as expected assert_equal "${#ID_LIST2[@]}" 210 assert_output "" +} + +@test "[$TESTSUITE] Test Update and pruge with feed item>200; items<200"{ + # Generate Feed with 210 items. + php ${BATS_TEST_DIRNAME}/../test_helper/php-feed-generator/feed-generator.php -a 210 -f ${BATS_TEST_DIRNAME}/../test_helper/feeds/test.xml + # Create Feed + FEEDID=$(http --ignore-stdin -b -a ${user}:${APP_PASSWORD} POST ${BASE_URLv1}/feeds url=$TEST_FEED | grep -Po '"id":\K([0-9]+)') + # Get Items + ID_LIST=($(http --ignore-stdin -b -a ${user}:${APP_PASSWORD} GET ${BASE_URLv1}/items | grep -Po '"id":\K([0-9]+)' | tr '\n' ' ')) + + # get biggest item ID + max=${ID_LIST[0]} + for n in "${ID_LIST[@]}" ; do + ((n > max)) && max=$n + done + + # mark all items of feed as read, returns nothing + STATUS_CODE=$(http --ignore-stdin -hdo /tmp/body -a ${user}:${APP_PASSWORD} PUT ${BASE_URLv1}/feeds/$FEEDID/read newestItemId="$max" 2>&1| grep -Po '(?<=HTTP\/1\.1 )[0-9]{3}(?= OK)') + # cleanup, purge items + http --ignore-stdin -b -a ${user}:${APP_PASSWORD} GET ${BASE_URLv1}/cleanup/after-update + + FIRST_UPDATE="$(http --ignore-stdin -b -a ${user}:${APP_PASSWORD} GET ${BASE_URLv1}/items getRead=false | grep -Po '"id":\K([0-9]+)' | tr '\n' ' ')" + + assert_equal "${FIRST_UPDATE}" "" + + ##TODO }
\ No newline at end of file |