1from pathlib import Path
2
3from qbpm import Profile
4from qbpm.config import Config
5from qbpm.desktop import create_desktop_file
6
7TEST_DIR = Path(__file__).resolve().parent
8
9
10def test_create_desktop_file(tmp_path: Path):
11 application_path = tmp_path / "applications"
12 application_path.mkdir()
13 profile = Profile("test", tmp_path)
14 create_desktop_file(profile, application_path, Config.load(None).application_name)
15 assert (application_path / "test.desktop").read_text() == (
16 TEST_DIR / "test.desktop"
17 ).read_text().replace("{qbpm}", " ".join(profile.cmdline()))
18
19
20def test_custom_name(tmp_path: Path):
21 application_path = tmp_path / "applications"
22 application_path.mkdir()
23 profile = Profile("test", tmp_path)
24 create_desktop_file(profile, application_path, "test")
25 assert "Name=test\n" in (application_path / "test.desktop").read_text()