Debian Codegraph @

python/mozrelease/test/test_balrog.py

raw
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5 import json
6 from pathlib import Path
7
8 import mozunit
9 import pytest
10 from mozilla_version.gecko import GeckoVersion
11
12 from mozrelease.balrog import generate_update_properties
13 from mozrelease.util import load as yaml_load
14
15 DATA_PATH = Path(__file__).parent.joinpath("data")
16
17
18 @pytest.mark.parametrize(
19 "context,config_file,output_file",
20 [
21 (
22 {
23 "release-type": "release",
24 "product": "firefox",
25 "version": GeckoVersion.parse("62.0.3"),
26 },
27 "whatsnew-62.0.3.yml",
28 "Firefox-62.0.3.update.json",
29 ),
30 (
31 {
32 "release-type": "beta",
33 "product": "firefox",
34 "version": GeckoVersion.parse("64.0"),
35 },
36 "whatsnew-62.0.3.yml",
37 "Firefox-64.0b13.update.json",
38 ),
39 ],
40 )
41 def test_update_properties(context, config_file, output_file):
42 with DATA_PATH.joinpath(config_file).open("r", encoding="utf-8") as f:
43 config = yaml_load(f)
44
45 update_line = generate_update_properties(context, config)
46
47 assert update_line == json.load(
48 DATA_PATH.joinpath(output_file).open("r", encoding="utf-8")
49 )
50
51
52 if __name__ == "__main__":
53 mozunit.main()