-
Notifications
You must be signed in to change notification settings - Fork 5.6k
system.reboot instead of system.restart #60111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| "Success": True, | ||
| } | ||
|
|
||
| mock_reboot = MagicMock(return_value=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (non-blocking) FWIW, a great way to avoid the problem of non-existent functions is to use create_autospec. Sometimes it's no bueno, but usually:
mock_reboot = create_autospec(return_value=True)
Found wherever other useful Mocks are sold!
|
|
||
| mock_reboot = MagicMock(return_value=True) | ||
| with patch.object( | ||
| win_servermanager, "_pshell_json", return_value=mock_out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion(non-blocking) Then in cases like this, adding autospec=True to the patch call, will ensure that the mock looks like the real _pshell_json.
| } | ||
| ], | ||
| "ExitCode": 0, | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (non-blocking): note that when the same data is found in multiple tests, especially if the same function is mocked to return that same data each time, that's an ideal place to use a pytest fixture.
What does this PR do?
Uses
system.rebootinstead of the non-existentsystem.restartNeed to finish up the tests
What issues does this PR fix or reference?
Fixes: #59424
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes