diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2021-06-10 09:57:23 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2021-06-10 09:57:23 -0400 |
commit | 723f4d79a6181b60f03f9573a394a85895f5cf03 (patch) | |
tree | 17473f4516f85ba7e534d39c73aedcb52bb4bc58 /tests/test___init__.py | |
parent | b18f05bdcaae1356124192b81a5e941261e67b63 (diff) | |
download | b4-723f4d79a6181b60f03f9573a394a85895f5cf03.tar.gz |
Start using pytest for the test framework
Since we're not caring about 2.x compatibility, pytest seems to be a
good candidate for this job. Obviously, there's a lot of ground to
cover, but the goal is to do all future modifications with tests added
so we can reduce regressions.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'tests/test___init__.py')
-rw-r--r-- | tests/test___init__.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test___init__.py b/tests/test___init__.py new file mode 100644 index 0000000..5a09584 --- /dev/null +++ b/tests/test___init__.py @@ -0,0 +1,15 @@ +import pytest # noqa +import b4 + + +@pytest.mark.parametrize('source,expected', [ + ('good-valid-trusted', (True, True, True, 'B6C41CE35664996C', '1623274836')), + ('good-valid-notrust', (True, True, False, 'B6C41CE35664996C', '1623274836')), + ('good-invalid-notrust', (True, False, False, 'B6C41CE35664996C', None)), + ('badsig', (False, False, False, 'B6C41CE35664996C', None)), + ('no-pubkey', (False, False, False, None, None)), +]) +def test_check_gpg_status(source, expected): + with open(f'tests/samples/gpg-{source}.txt', 'r') as fh: + status = fh.read() + assert b4.check_gpg_status(status) == expected |