From 723f4d79a6181b60f03f9573a394a85895f5cf03 Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Thu, 10 Jun 2021 09:57:23 -0400 Subject: 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 --- tests/test___init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/test___init__.py (limited to 'tests/test___init__.py') 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 -- cgit v1.2.3