aurweb/test/t1100-git-auth.t
Kevin Morris e800cefe95 Makefile: run pytest units
Important note: Python tests will repeatedly clear out tables
that they test against; for this reason, one should always run
the shell tests first. The __init__.py file is necessary for
coverage to collect data from the tests being run.

At this point in FastAPI development, I'd like to encourage a
few things going forward:

1. Any time you contribute to the FastAPI codebase, you **must**
   maintain equal or increased coverage on the overall source.
   Developers are highly appreciated for adding tests in your
   specific domain of addition or modification that may be missing
   coverage. Our goal is 100% coverage, and all newly added files
   **must** have 100% coverage through tests.
2. All source should be formatted with the autopep8 tool and
   kept within an 80 column width, with the exception of HTML
   templates.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-06-05 19:49:19 -07:00

29 lines
755 B
Bash
Executable file

#!/bin/sh
test_description='git-auth tests'
. "$(dirname "$0")/setup.sh"
test_expect_success 'Test basic authentication.' '
cover "$GIT_AUTH" "$AUTH_KEYTYPE_USER" "$AUTH_KEYTEXT_USER" >out &&
grep -q AUR_USER=user out &&
grep -q AUR_PRIVILEGED=0 out
'
test_expect_success 'Test Trusted User authentication.' '
cover "$GIT_AUTH" "$AUTH_KEYTYPE_TU" "$AUTH_KEYTEXT_TU" >out &&
grep -q AUR_USER=tu out &&
grep -q AUR_PRIVILEGED=1 out
'
test_expect_success 'Test authentication with an unsupported key type.' '
test_must_fail cover "$GIT_AUTH" ssh-xxx "$AUTH_KEYTEXT_USER"
'
test_expect_success 'Test authentication with a wrong key.' '
cover "$GIT_AUTH" "$AUTH_KEYTYPE_MISSING" "$AUTH_KEYTEXT_MISSING" >out
test_must_be_empty out
'
test_done