diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2016-12-07 08:58:34 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2016-12-20 18:04:46 +0100 |
commit | 6d8edafe778809698246019c165b7c20b1e0afdf (patch) | |
tree | 434c1253c17887589c67d60dad8c2ecd9f9c668b | |
parent | e0d94f54c32f39f3709694b81f55a8ec46d11d5a (diff) | |
download | aur-6d8edafe778809698246019c165b7c20b1e0afdf.tar.gz aur-6d8edafe778809698246019c165b7c20b1e0afdf.tar.xz |
t1200: Add tests for flag/unflag
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
-rwxr-xr-x | test/t1200-git-serve.sh | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/test/t1200-git-serve.sh b/test/t1200-git-serve.sh index 6fa6f957..d422c480 100755 --- a/test/t1200-git-serve.sh +++ b/test/t1200-git-serve.sh @@ -351,4 +351,67 @@ test_expect_success "Check whether package requests are closed when disowning." test_cmp actual expected ' +test_expect_success "Flag a package base out-of-date." ' + SSH_ORIGINAL_COMMAND="flag foobar Because." AUR_USER=user2 AUR_PRIVILEGED=0 \ + "$GIT_SERVE" 2>&1 && + cat >expected <<-EOF && + 1|Because. + EOF + echo "SELECT OutOfDateTS IS NOT NULL, FlaggerComment FROM PackageBases WHERE ID = 3;" | \ + sqlite3 aur.db >actual && + test_cmp expected actual +' + +test_expect_success "Unflag a package base as flagger." ' + SSH_ORIGINAL_COMMAND="unflag foobar" AUR_USER=user2 AUR_PRIVILEGED=0 \ + "$GIT_SERVE" 2>&1 && + cat >expected <<-EOF && + 0|Because. + EOF + echo "SELECT OutOfDateTS IS NOT NULL, FlaggerComment FROM PackageBases WHERE ID = 3;" | \ + sqlite3 aur.db >actual && + test_cmp expected actual +' + +test_expect_success "Unflag a package base as maintainer." ' + SSH_ORIGINAL_COMMAND="adopt foobar" AUR_USER=user AUR_PRIVILEGED=0 \ + "$GIT_SERVE" 2>&1 && + SSH_ORIGINAL_COMMAND="flag foobar Because." AUR_USER=user2 AUR_PRIVILEGED=0 \ + "$GIT_SERVE" 2>&1 && + SSH_ORIGINAL_COMMAND="unflag foobar" AUR_USER=user AUR_PRIVILEGED=0 \ + "$GIT_SERVE" 2>&1 && + cat >expected <<-EOF && + 0|Because. + EOF + echo "SELECT OutOfDateTS IS NOT NULL, FlaggerComment FROM PackageBases WHERE ID = 3;" | \ + sqlite3 aur.db >actual && + test_cmp expected actual +' + +test_expect_success "Unflag a package base as random user." ' + SSH_ORIGINAL_COMMAND="flag foobar Because." AUR_USER=user2 AUR_PRIVILEGED=0 \ + "$GIT_SERVE" 2>&1 && + SSH_ORIGINAL_COMMAND="unflag foobar" AUR_USER=user3 AUR_PRIVILEGED=0 \ + "$GIT_SERVE" 2>&1 && + cat >expected <<-EOF && + 1|Because. + EOF + echo "SELECT OutOfDateTS IS NOT NULL, FlaggerComment FROM PackageBases WHERE ID = 3;" | \ + sqlite3 aur.db >actual && + test_cmp expected actual +' + +test_expect_success "Flag using a comment which is too short." ' + SSH_ORIGINAL_COMMAND="unflag foobar" AUR_USER=user2 AUR_PRIVILEGED=0 \ + "$GIT_SERVE" 2>&1 && + SSH_ORIGINAL_COMMAND="flag foobar xx" AUR_USER=user2 AUR_PRIVILEGED=0 \ + test_must_fail "$GIT_SERVE" 2>&1 && + cat >expected <<-EOF && + 0|Because. + EOF + echo "SELECT OutOfDateTS IS NOT NULL, FlaggerComment FROM PackageBases WHERE ID = 3;" | \ + sqlite3 aur.db >actual && + test_cmp expected actual +' + test_done |