23 lines
941 B
Python
23 lines
941 B
Python
"""服务端分发产物生成测试。"""
|
|
import plistlib
|
|
|
|
from backend.services.distribution import _write_distribution_files, _write_download_page, _write_manifest
|
|
|
|
|
|
def test_distribution_files_use_current_service_config(tmp_path):
|
|
ipa = tmp_path / "source.ipa"
|
|
ipa.write_bytes(b"ipa")
|
|
config = {
|
|
"APPID": "100", "VERSION": "2.0.0", "APPID_NAME": "Test App",
|
|
"BUNDLE_ID": "com.example.test",
|
|
}
|
|
ipa_file, manifest, html = _write_distribution_files(config, ipa, tmp_path / "distribution")
|
|
_write_manifest(config, manifest, "https://files.example.com/app.ipa")
|
|
_write_download_page(config, html, "https://files.example.com/app.plist")
|
|
|
|
with manifest.open("rb") as f:
|
|
plist = plistlib.load(f)
|
|
assert ipa_file.read_bytes() == b"ipa"
|
|
assert plist["items"][0]["metadata"]["bundle-identifier"] == "com.example.test"
|
|
assert "itms-services://" in html.read_text(encoding="utf-8")
|