-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor insights-client call and RHSM check
Signed-off-by: Andrea Waltlova <[email protected]>
- Loading branch information
1 parent
6e53a72
commit edad91c
Showing
4 changed files
with
48 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from mock import patch | ||
import pytest | ||
from scripts.leapp_preupgrade import update_insights_inventory, ProcessError | ||
|
||
|
||
def test_update_insights_inventory_successfully(): | ||
with patch( | ||
"scripts.leapp_preupgrade.run_subprocess", return_value=(b"", 0) | ||
) as mock_popen: | ||
update_insights_inventory() | ||
|
||
mock_popen.assert_called_once_with(cmd=["/usr/bin/insights-client"]) | ||
|
||
|
||
def test_update_insights_inventory_non_success(): | ||
with patch( | ||
"scripts.leapp_preupgrade.run_subprocess", return_value=(b"output", 1) | ||
) as mock_popen: | ||
with pytest.raises( | ||
ProcessError, match="insights-client execution exited with code '1'" | ||
): | ||
update_insights_inventory() | ||
|
||
mock_popen.assert_called_once_with(cmd=["/usr/bin/insights-client"]) |