Debian Codegraph @

tests/platforms/windows/visualstudio/test_package.py

raw
1 # The package command inherits most of its behavior from the common base
2 # implementation. Do a surface-level verification here, but the app
3 # tests provide the actual test coverage.
4 from unittest import mock
5
6 import pytest
7
8 from briefcase.integrations.subprocess import Subprocess
9 from briefcase.integrations.wix import WiX
10 from briefcase.platforms.windows.visualstudio import WindowsVisualStudioPackageCommand
11
12 from ....integrations.wix.conftest import WIX_EXE_PATH, WIX_UI_PATH
13
14
15 @pytest.fixture
16 def package_command(dummy_console, tmp_path):
17 command = WindowsVisualStudioPackageCommand(
18 console=dummy_console,
19 base_path=tmp_path / "base_path",
20 data_path=tmp_path / "briefcase",
21 )
22 command.tools.subprocess = mock.MagicMock(spec_set=Subprocess)
23 command.tools.wix = WiX(command.tools, wix_home=tmp_path / "wix")
24 return command
25
26
27 def test_package_msi(package_command, first_app_config, tmp_path):
28 """A Windows app can be packaged as an MSI."""
29
30 package_command.package_app(first_app_config)
31
32 assert package_command.tools.subprocess.run.mock_calls == [
33 # Compile MSI
34 mock.call(
35 [
36 tmp_path / "wix" / WIX_EXE_PATH,
37 "build",
38 "-ext",
39 tmp_path / "wix" / WIX_UI_PATH,
40 "-arch",
41 "x64",
42 "first-app.wxs",
43 "-loc",
44 "unicode.wxl",
45 "-pdbtype",
46 "none",
47 "-o",
48 tmp_path / "base_path/dist/First App-0.0.1.msi",
49 ],
50 check=True,
51 cwd=tmp_path / "base_path/build/first-app/windows/visualstudio",
52 ),
53 ]