Skip to content

Commit

Permalink
chore: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GabDug committed Jan 18, 2023
1 parent aece727 commit 47509d9
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/cli/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def test_repository_overwrite_default(project):
assert repository.url == "https://example.pypi.org/legacy/"


def test_hide_password_in_output(project, invoke):
def test_hide_password_in_output_repository(project, invoke):
assert project.global_config["repository.pypi.password"] is None
project.global_config["repository.pypi.username"] = "testuser"
project.global_config["repository.pypi.password"] = "secret"
Expand All @@ -138,6 +138,20 @@ def test_hide_password_in_output(project, invoke):
result = invoke(["config", "repository.pypi.password"], obj=project, strict=True)
assert "<hidden>" == result.output.strip()

def test_hide_password_in_output_pypi(project, invoke):
with pytest.raises( KeyError):
assert project.global_config["pypi.extra.password"] is None
project.global_config["pypi.extra.username"] = "testuser"
project.global_config["pypi.extra.password"] = "secret"
project.global_config["pypi.extra.url"] = "https://test/simple"
result = invoke(["config", "pypi.extra"], obj=project, strict=True)
assert "password = <hidden>" in result.output
result = invoke(["config", "pypi.extra.password"], obj=project, strict=True)
assert "<hidden>" == result.output.strip()
result = invoke(["config"], obj=project)
assert "pypi.extra.password" in result.output
assert "<hidden>" in result.output


def test_config_get_repository(project, invoke):
config = project.global_config["repository.pypi"]
Expand Down

0 comments on commit 47509d9

Please sign in to comment.