diff options
author | Sean Molenaar <sean@seanmolenaar.eu> | 2021-02-23 17:19:10 +0100 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2021-03-01 21:13:44 +0100 |
commit | bcdeb55fcbbbd02955e5cafd47d8d8db2670f22c (patch) | |
tree | a525dcbe2109b5cd180c765707001a462656371c /tests/integration/items.bats | |
parent | 59885c27f7a6cddc2a6d06d1a91885780190f1ee (diff) |
Actions: Integration tests using bats
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
Diffstat (limited to 'tests/integration/items.bats')
-rw-r--r-- | tests/integration/items.bats | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/integration/items.bats b/tests/integration/items.bats new file mode 100644 index 000000000..e85c8956c --- /dev/null +++ b/tests/integration/items.bats @@ -0,0 +1,51 @@ +#!/usr/bin/env bats + +load "helpers/settings" + +TESTSUITE="Items" + +setup() { + ./occ news:feed:add "$user" "https://github.com/nextcloud/news/releases.atom" --title "Something-${BATS_SUITE_TEST_NUMBER}" + + TAG=$(curl --silent "https://api.github.com/repos/nextcloud/news/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') + ID=$(./occ news:feed:list 'admin' | grep 'github\.com' -1 | head -1 | grep -oE '[0-9]*') +} + +teardown() { + if [ -n "$ID" ]; then + ./occ news:feed:delete "$user" "$ID" + fi +} + +@test "[$TESTSUITE] List all items in feed" { + run ./occ news:item:list-feed "$user" "$ID" --limit 200 + [ "$status" -eq 0 ] + + if ! echo "$output" | grep "$TAG"; then + ret_status=$? + echo "Release not found in feed list" + return $ret_status + fi +} + +@test "[$TESTSUITE] List all items in folder" { + run ./occ news:item:list-folder "$user" --limit 200 + [ "$status" -eq 0 ] + + if ! echo "$output" | grep "$TAG"; then + ret_status=$? + echo "Release not found in folder list" + return $ret_status + fi +} + +@test "[$TESTSUITE] List all items" { + run ./occ news:item:list "$user" --limit 200 + [ "$status" -eq 0 ] + + if ! echo "$output" | grep "$TAG"; then + ret_status=$? + echo "Release not found in list" + return $ret_status + fi +}
\ No newline at end of file |