Skip to content

Commit

Permalink
Fix wrong variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
pgiraud committed Dec 12, 2024
1 parent cadcf33 commit 89610ae
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/test_hba.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,24 +201,24 @@ def test_parse_file(mocker, tmp_path):
mocker.patch("builtins.open", m)
except Exception:
mocker.patch("__builtin__.open", m)
pgpass = parse("filename")
pgpass.lines.append(HBAComment("# Something"))
hba = parse("filename")
hba.lines.append(HBAComment("# Something"))

assert m.called
pgpass.save()
hba.save()
handle = m()
handle.write.assert_called_with("# Something\n")

# Also works for other string types
m.reset_mock()
pgpass = parse("filename")
pgpass.lines.append(HBAComment("# Something"))
hba = parse("filename")
hba.lines.append(HBAComment("# Something"))
assert m.called

# Also works with path
m.reset_mock()
pgpass = parse(tmp_path / "filename")
pgpass.lines.append(HBAComment("# Something"))
hba = parse(tmp_path / "filename")
hba.lines.append(HBAComment("# Something"))

assert m.called

Expand Down

0 comments on commit 89610ae

Please sign in to comment.