Skip to content

Commit

Permalink
Fix tests to support Python 3.5
Browse files Browse the repository at this point in the history
assert_called() was introduced in 3.6... 😭
  • Loading branch information
pieqq committed Oct 20, 2023
1 parent d78eed4 commit d067071
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions providers/base/tests/test_snap_update_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ def test_load_change_info_file_not_found(self, mock_open):
@patch("snap_update_test.json")
def test_load_change_info(self, mock_json, mock_open):
snap_update_test.load_change_info("test")
mock_json.load.assert_called()
self.assertTrue(mock_json.load.called)

@patch("snap_update_test.print_resource_info")
def test_main_print_resource(self, mock_print_resource_info):
args = ["--resource"]
snap_update_test.main(args)
mock_print_resource_info.assert_called()
self.assertTrue(mock_print_resource_info.called)

@patch("snap_update_test.SnapRefreshRevert")
def test_main_refresh(self, mock_srr):
args = ["--refresh", "--info-path", "/tmp/change.json", "chromium"]
snap_update_test.main(args)
instance = mock_srr.return_value
instance.snap_refresh.assert_called()
self.assertTrue(instance.snap_refresh.called)

@patch("snap_update_test.SnapRefreshRevert")
def test_main_verify_refresh(self, mock_srr):
Expand All @@ -74,7 +74,7 @@ def test_main_revert(self, mock_srr):
args = ["--revert", "--info-path", "/tmp/change.json", "chromium"]
snap_update_test.main(args)
instance = mock_srr.return_value
instance.snap_revert.assert_called()
self.assertTrue(instance.snap_revert.called)

@patch("snap_update_test.SnapRefreshRevert")
def test_main_verify_revert(self, mock_srr):
Expand Down Expand Up @@ -143,7 +143,7 @@ def test_snap_refresh_different_revision(
mock_self.snap_info = mock_snap_info
logging.disable(logging.CRITICAL)
snap_update_test.SnapRefreshRevert.snap_refresh(mock_self)
snap_update_test.save_change_info.assert_called()
self.assertTrue(snap_update_test.save_change_info.called)

@patch("snap_update_test.Snapd.revert")
@patch("snap_update_test.load_change_info")
Expand All @@ -155,8 +155,8 @@ def test_snap_revert(
mock_snap_info = MagicMock()
mock_self.snap_info = mock_snap_info
snap_update_test.SnapRefreshRevert.snap_revert(mock_self)
snap_update_test.load_change_info.assert_called()
snap_update_test.save_change_info.assert_called()
self.assertTrue(snap_update_test.load_change_info.called)
self.assertTrue(snap_update_test.save_change_info.called)

def test_verify_invalid(self):
mock_self = MagicMock()
Expand Down

0 comments on commit d067071

Please sign in to comment.