Disable Factorio recycler on vanilla server
Validate, publish and promote Factorio chart / chart (push) Successful in 18s
Validate, publish and promote Factorio chart / chart (push) Successful in 18s
This commit is contained in:
1 parent
b21b78a287
commit
df6af9d0d1
5 files changed
+65
-1
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import json
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parents[1] / "scripts/disable-recycler.sh"
|
||||
|
||||
|
||||
class ModListTests(unittest.TestCase):
|
||||
def test_disables_recycler_without_changing_other_mods(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
path = Path(directory) / "mod-list.json"
|
||||
path.write_text(json.dumps({"mods": [
|
||||
{"name": "base", "enabled": True},
|
||||
{"name": "recycler", "enabled": True},
|
||||
{"name": "my-mod", "enabled": True},
|
||||
]}))
|
||||
|
||||
subprocess.run(["bash", str(SCRIPT), str(path)], check=True)
|
||||
mods = {mod["name"]: mod["enabled"] for mod in json.loads(path.read_text())["mods"]}
|
||||
|
||||
self.assertFalse(mods["recycler"])
|
||||
self.assertTrue(mods["base"])
|
||||
self.assertTrue(mods["my-mod"])
|
||||
|
||||
def test_adds_recycler_disabled_to_new_mod_list(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
path = Path(directory) / "mods" / "mod-list.json"
|
||||
|
||||
subprocess.run(["bash", str(SCRIPT), str(path)], check=True)
|
||||
mods = {mod["name"]: mod["enabled"] for mod in json.loads(path.read_text())["mods"]}
|
||||
|
||||
self.assertTrue(mods["base"])
|
||||
self.assertFalse(mods["recycler"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user