Skip to content

Commit

Permalink
Test reading hold state of snaps
Browse files Browse the repository at this point in the history
  • Loading branch information
james-garner-canonical committed Sep 6, 2024
1 parent 878d5d8 commit efa9990
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/unit/test_snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,3 +1064,11 @@ def test_alias_raises_snap_error(self, mock_subprocess):
universal_newlines=True,
)
mock_subprocess.reset_mock()

@patch("charms.operator_libs_linux.v2.snap.subprocess.check_output")
def test_held(self, mock_subprocess: MagicMock):
foo = snap.Snap("foo", snap.SnapState.Latest, "stable", "1", "classic")
mock_subprocess.return_value = {}
self.assertEqual(foo.held, False)
mock_subprocess.return_value = {"hold:": "key isn't checked"}
self.assertEqual(foo.held, True)

0 comments on commit efa9990

Please sign in to comment.