11
11
12
12
import pytest
13
13
14
- from tests .fixtures import BASE_CONFIG , MODLIST_DICT , MODLIST_JSON
14
+ from tests .fixtures import (
15
+ BASE_CONFIG ,
16
+ MODLIST_DICT ,
17
+ MODLIST_DICT_VERSIONLESS ,
18
+ MODLIST_JSON ,
19
+ )
20
+ from zeusops_bot .models import ModDetail
15
21
from zeusops_bot .reforger_config_gen import ReforgerConfigGenerator , extract_mods
16
22
17
23
18
- @pytest .mark .parametrize ("activate" , (False , True ))
19
- def test_upload_edits_files (base_config : Path , mission_dir : Path , activate : bool ):
24
+ @pytest .mark .parametrize (
25
+ "keep_versions,mods" ,
26
+ [(False , MODLIST_DICT_VERSIONLESS ), (True , MODLIST_DICT )],
27
+ ids = ["strip versions" , "keep versions" ],
28
+ )
29
+ @pytest .mark .parametrize ("activate" , (False , True ), ids = ["no activate" , "activate" ])
30
+ def test_upload_edits_files (
31
+ base_config : Path ,
32
+ mission_dir : Path ,
33
+ activate : bool ,
34
+ keep_versions : bool ,
35
+ mods : list [ModDetail ],
36
+ ):
20
37
"""Scenario: Upload next mission creates file"""
21
38
# Given a Zeusops mission locally ready
22
39
# And Zeus specifies <modlist.json>, <scenarioId>, <filename>
@@ -26,15 +43,15 @@ def test_upload_edits_files(base_config: Path, mission_dir: Path, activate: bool
26
43
base_config_file = base_config , target_folder = mission_dir
27
44
)
28
45
# When Zeus calls "/zeus-upload"
29
- modlist = extract_mods (MODLIST_JSON )
46
+ modlist = extract_mods (MODLIST_JSON , keep_versions )
30
47
out_path = config_gen .zeus_upload (scenario_id , filename , modlist , activate )
31
48
# Then a new server config file is created
32
49
assert out_path .is_file (), "Should have generated a file on disk"
33
50
# And the config file is patched with <modlist.json> and <scenarioId>
34
51
config = json .loads (out_path .read_text ())
35
52
assert config ["game" ]["scenarioId" ] == scenario_id , "Should update scenarioId"
36
53
assert isinstance (config ["game" ]["mods" ], list )
37
- assert config ["game" ]["mods" ][0 ] == MODLIST_DICT [0 ]
54
+ assert config ["game" ]["mods" ][0 ] == mods [0 ]
38
55
39
56
40
57
def test_upload_activate_mission (base_config : Path , mission_dir : Path ):
0 commit comments