Skip to content

Commit

Permalink
Make tests more pleasant
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismeyersfsu committed Nov 20, 2024
1 parent 1a7611e commit 7f75fdd
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions tests/_temporary_private_credential_api_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Tests for the temporarily hosted private helpers."""
"""Tests for the temporarily hosted private credential structure."""

import pytest

Expand All @@ -16,8 +16,8 @@ def test_credential_instantiation() -> None:
@pytest.mark.parametrize(
('inputs', 'key', 'expected'),
(
({'foo': 'bar'}, 'foo', 'bar'),
({'foo1': 'bar1'}, 'baz', None),
pytest.param({'foo': 'bar'}, 'foo', 'bar', id='key-present'),
pytest.param({'foo1': 'bar1'}, 'baz', None, id='key-missing'),
),
)
def test_credential_get_input(
Expand All @@ -26,14 +26,24 @@ def test_credential_get_input(
expected: str,
) -> None:
"""Check that get_input operates on the dict we provided."""
assert Credential(inputs=inputs).get_input(key) == expected
assert Credential(inputs=inputs).get_input(key) is expected


@pytest.mark.parametrize(
('inputs', 'key', 'expected'),
(
({'foo2': 'bar2'}, 'foo2', True),
({'foo3': 'bar3'}, 'baz', False),
pytest.param(
{'foo2': 'bar2'},
'foo2',
True, # noqa: WPS425
id='key-present',
),
pytest.param(
{'foo3': 'bar3'},
'baz',
False, # noqa: WPS425
id='key-missing',
),
),
)
def test_credential_has_input(
Expand All @@ -42,4 +52,4 @@ def test_credential_has_input(
expected: bool,
) -> None:
"""Check that has_input behaves like dict in operator."""
assert Credential(inputs=inputs).has_input(key) == expected
assert Credential(inputs=inputs).has_input(key) is expected

0 comments on commit 7f75fdd

Please sign in to comment.