From 36fd0c0bb6531ce4b226b3ff39009f48aef7f706 Mon Sep 17 00:00:00 2001 From: scito Date: Tue, 3 Jan 2023 23:31:36 +0100 Subject: [PATCH] add test keepass with no data --- README.md | 2 +- tests/data/only_comments.txt | 3 +++ tests/extract_otp_secrets_test.py | 12 ++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/data/only_comments.txt diff --git a/README.md b/README.md index 42ffc87..f9d1695 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Extract TOTP/HOTP secrets from QR codes exported by two-factor authentication apps [![CI tests](https://github.com/scito/extract_otp_secrets/actions/workflows/ci.yml/badge.svg)](https://github.com/scito/extract_otp_secrets/actions/workflows/ci.yml) -![coverage](https://img.shields.io/badge/coverage-96%25-brightgreen) +![coverage](https://img.shields.io/badge/coverage-93%25-brightgreen) [![CI docker](https://github.com/scito/extract_otp_secrets/actions/workflows/ci_docker.yml/badge.svg)](https://github.com/scito/extract_otp_secrets/actions/workflows/ci_docker.yml) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/protobuf) [![GitHub Pipenv locked Python version](https://img.shields.io/github/pipenv/locked/python-version/scito/extract_otp_secrets)](https://github.com/scito/extract_otp_secrets/blob/master/Pipfile.lock) diff --git a/tests/data/only_comments.txt b/tests/data/only_comments.txt new file mode 100644 index 0000000..59f7a06 --- /dev/null +++ b/tests/data/only_comments.txt @@ -0,0 +1,3 @@ +# comment 1 + +# comment 2 diff --git a/tests/extract_otp_secrets_test.py b/tests/extract_otp_secrets_test.py index fbecd10..b8e90db 100644 --- a/tests/extract_otp_secrets_test.py +++ b/tests/extract_otp_secrets_test.py @@ -225,6 +225,18 @@ def test_keepass_csv(capsys: pytest.CaptureFixture[str], tmp_path: pathlib.Path) assert captured.err == '' +def test_keepass_empty(capsys: pytest.CaptureFixture[str], tmp_path: pathlib.Path) -> None: + # Act + extract_otp_secrets.main(['-k', '-', 'tests/data/only_comments.txt']) + + # Assert + + captured = capsys.readouterr() + + assert captured.out == '' + assert captured.err == '' + + def test_keepass_csv_stdout(capsys: pytest.CaptureFixture[str]) -> None: '''Two csv files .totp and .htop are generated.''' # Act