Test get_delta when parsing CBOR.
(self)
| 1256 | ) |
| 1257 | |
| 1258 | def test_get_delta_cbor(self): |
| 1259 | """Test get_delta when parsing CBOR.""" |
| 1260 | mock_assets = (("foo", "foo"), ("foo.tar.gz", "foo")) |
| 1261 | os.environ["PROTONPATH"] = umu_proton.ProtonVersion.UMULatest.value |
| 1262 | |
| 1263 | # If either cbor2 or the Rust module DNE, skip |
| 1264 | try: |
| 1265 | from cbor2 import dumps |
| 1266 | except ModuleNotFoundError: |
| 1267 | err = "python3-cbor2 not installed" |
| 1268 | self.skipTest(err) |
| 1269 | |
| 1270 | if find_spec("umu_delta") is None: |
| 1271 | err = "umu_delta module not compiled" |
| 1272 | self.skipTest(err) |
| 1273 | |
| 1274 | mock_patch = dumps({"foo": "foo"}) |
| 1275 | mock_ctx = MagicMock() |
| 1276 | mock_ctx.__enter__ = MagicMock(return_value=None) |
| 1277 | mock_ctx.__exit__ = MagicMock(return_value=None) |
| 1278 | |
| 1279 | self.test_umu_compat.joinpath(os.environ["PROTONPATH"]).mkdir( |
| 1280 | parents=True, exist_ok=True |
| 1281 | ) |
| 1282 | |
| 1283 | with patch.object(umu_proton, "unix_flock", return_value=mock_ctx): |
| 1284 | result = umu_proton._get_delta( |
| 1285 | self.env, |
| 1286 | self.test_umu_compat, |
| 1287 | mock_patch, |
| 1288 | mock_assets, |
| 1289 | self.test_session_pools, |
| 1290 | ) |
| 1291 | self.assertTrue(result is None, f"Expected None, received {result}") |
| 1292 | |
| 1293 | def test_get_delta_cbor_err(self): |
| 1294 | """Test get_delta when parsing invalid CBOR.""" |