diff options
author | Benjamin Brahmer <info@b-brahmer.de> | 2022-03-18 20:44:01 +0100 |
---|---|---|
committer | Benjamin Brahmer <info@b-brahmer.de> | 2022-05-03 21:27:48 +0200 |
commit | 2a0e75e7478cb6101d3f562fb619597b34574a3f (patch) | |
tree | 86149658329489d3a47ec6cfa4d9fc428717b9ae | |
parent | fe1c42ce73b5c5ac3d499dad303a99dea240fcf4 (diff) |
test check updated items, not final
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
-rw-r--r-- | tests/api/items.bats | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/api/items.bats b/tests/api/items.bats index cbb7a3960..f1ca82987 100644 --- a/tests/api/items.bats +++ b/tests/api/items.bats @@ -40,4 +40,28 @@ teardown() { output=${#ID_LIST[@]} assert_output --partial "5" +} + +# TODO GET /items has more options that could be tested. + +@test "[$TESTSUITE] Check updated" { + FEEDID=$(http --ignore-stdin -b -a ${user}:${user} POST ${BASE_URLv1}/feeds url=$NC_FEED | grep -Po '"id":\K([0-9]+)') + ID_LIST=($(http --ignore-stdin -b -a ${user}:${user} GET ${BASE_URLv1}/items id=$FEEDID | 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 + + SYNC_TIME=$(date +%s) + + # mark all items of feed as read, returns nothing (other client marks items as read) + STATUS_CODE=$(http --ignore-stdin -hdo /tmp/body -a ${user}:${user} PUT ${BASE_URLv1}/feeds/$FEEDID/read newestItemId="$max" 2>&1| grep HTTP/) + + # client 2 checks for updates since last sync + UPDATED_ITEMS=$(http --ignore-stdin -b -a ${user}:${user} GET ${BASE_URLv1}/items/updated id=$FEEDID lastModified=$SYNC_TIME | tr -d '[:space:]') + + echo $UPDATED_ITEMS + false }
\ No newline at end of file |