Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Phipps committed Mar 15, 2023
1 parent 7a09ded commit 49ec1ff
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/pytests/unit/modules/test_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@ def test_custom():
"time": "21:21",
"users": 2,
}
# test pass correct info with correct config
mock2.return_value = {"status.uptime.custom": ["days"]}
with patch.dict(status.__salt__, {"config.dot_vals": mock2}):
with patch.dict(status.__salt__, {"status.uptime": mock}):
assert status.custom() == {"days": 2}

mock.return_value = {
"days": 2,
"seconds": 249719,
"since_iso": "2023-02-27T06:19:01.590002",
"since_t": 1677478741,
"time": "21:21",
"users": 2,
}
# test pass correct info with incorrect config
mock2.return_value = {"status.fail.custom": ["days"]}
with patch.dict(status.__salt__, {"config.dot_vals": mock2}):
with patch.dict(status.__salt__, {"status.uptime": mock}):
assert status.custom() == {"days": "UNKNOWN"}
assert status.custom() == {}

# test incorrect info with correct config
mock2.return_value = {"status.uptime.custom": ["day"]}
with patch.dict(status.__salt__, {"config.dot_vals": mock2}):
with patch.dict(status.__salt__, {"status.uptime": mock}):
assert status.custom() == {"day": "UNKNOWN"}

0 comments on commit 49ec1ff

Please sign in to comment.