Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ganglyu committed Nov 4, 2024
1 parent db67045 commit 94d74f2
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/host_modules/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ def test_reload(self, MockInit, MockBusName, MockSystemBus):
mock_run.return_value = res_mock
config_db_json = "{}"
config_stub = config_engine.Config(config_engine.MOD_NAME)
ret, msg = config_stub.reload(config_db_json, "")
call_args = mock_run.call_args[0][0]
assert "reload" in call_args
assert "/dev/stdin" in call_args
ret, msg = config_stub.reload(config_db_json, "gnmi")
assert "systemctl mask" in mock_run.call_args[0][0]
assert "reload" in mock_run.call_args[1][0]
assert "/dev/stdin" in mock_run.call_args[1][0]
assert "systemctl unmask" in mock_run.call_args[2][0]
assert ret == test_ret, "Return value is wrong"
assert msg == "", "Return message is wrong"
with mock.patch("subprocess.run") as mock_run:
Expand All @@ -33,10 +34,11 @@ def test_reload(self, MockInit, MockBusName, MockSystemBus):
mock_run.return_value = res_mock
config_db_json = "{}"
config_stub = config_engine.Config(config_engine.MOD_NAME)
ret, msg = config_stub.reload(config_db_json, "")
call_args = mock_run.call_args[0][0]
assert "reload" in call_args
assert "/dev/stdin" in call_args
ret, msg = config_stub.reload(config_db_json, "gnmi")
assert "systemctl mask" in mock_run.call_args[0][0]
assert "reload" in mock_run.call_args[1][0]
assert "/dev/stdin" in mock_run.call_args[1][0]
assert "systemctl unmask" in mock_run.call_args[2][0]
assert ret == test_ret, "Return value is wrong"
assert msg == "Error: this is the test message", "Return message is wrong"

Expand Down

0 comments on commit 94d74f2

Please sign in to comment.