1
0
mirror of https://github.com/chylex/Nextcloud-News.git synced 2024-11-24 13:42:47 +01:00
Nextcloud-News/tests/integration/folders.bats
Sean Molenaar 78dce7ffe1 DB: Updates should use set()
Issue GH-1211

Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
2021-03-31 22:39:00 +02:00

65 lines
1.6 KiB
Bash

#!/usr/bin/env bats
load "helpers/settings"
TESTSUITE="Folders"
teardown() {
ID=$(./occ news:folder:list 'admin' | grep "Something-${BATS_SUITE_TEST_NUMBER}" -1 | head -1 | grep -oE '[0-9]*')
if [ -n "$ID" ]; then
./occ news:folder:delete "$user" "$ID"
fi
}
@test "[$TESTSUITE] Create new" {
run ./occ news:folder:add "$user" "Something-${BATS_SUITE_TEST_NUMBER}"
[ "$status" -eq 0 ]
if echo "$output" | grep 'new folder'; then
ret_status=$?
echo "Folder ID not returned"
return $ret_status
fi
}
@test "[$TESTSUITE] List all" {
./occ news:folder:add "$user" "Something-${BATS_SUITE_TEST_NUMBER}"
run ./occ news:folder:list "$user"
[ "$status" -eq 0 ]
if echo "$output" | grep "Something-${BATS_SUITE_TEST_NUMBER}"; then
ret_status=$?
echo "Folder not found in list"
return $ret_status
fi
}
@test "[$TESTSUITE] Read all" {
./occ news:folder:add "$user" "Something-${BATS_SUITE_TEST_NUMBER}"
ID=$(./occ news:folder:list 'admin' | grep "Something-${BATS_SUITE_TEST_NUMBER}" -1 | head -1 | grep -oE '[0-9]*')
run ./occ news:folder:read "$user" "$ID" -v
[ "$status" -eq 0 ]
if ! echo "$output" | grep "items as read"; then
ret_status=$?
echo "Folder not read"
return $ret_status
fi
}
@test "[$TESTSUITE] Delete all" {
ID=$(./occ news:folder:add "$user" "Something-${BATS_SUITE_TEST_NUMBER}" | grep -oE '[0-9]*')
run ./occ news:folder:list "$user"
[ "$status" -eq 0 ]
echo "$output" | grep "Something-${BATS_SUITE_TEST_NUMBER}"
run ./occ news:folder:delete "$user" "$ID"
[ "$status" -eq 0 ]
}