added
This commit is contained in:
1 parent
614d235bbe
commit
1e52a733d1
29 files changed
+728
-66
No files matched your search
@@ -1,7 +1,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
import json
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
@@ -27,6 +29,24 @@ class RepositoryValidationTests(unittest.TestCase):
|
||||
any("Missing required path" in item["message"] for item in result["findings"])
|
||||
)
|
||||
|
||||
def test_variable_identity_mismatch_fails(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
copy = Path(directory) / "repository"
|
||||
shutil.copytree(ROOT, copy, ignore=shutil.ignore_patterns(".git", "__pycache__"))
|
||||
variables_path = copy / "repository-variables.json"
|
||||
variables = json.loads(variables_path.read_text(encoding="utf-8"))
|
||||
variables["identity"]["publisher"]["name"] = "Different Publisher"
|
||||
variables_path.write_text(json.dumps(variables, indent=2) + "\n", encoding="utf-8")
|
||||
result = VALIDATOR.validate(copy)
|
||||
self.assertFalse(result["passed"])
|
||||
self.assertTrue(
|
||||
any(
|
||||
"Publisher differs between repository-variables.json and repository.json"
|
||||
in item["message"]
|
||||
for item in result["findings"]
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user