Add SSM deployment and reliable Maven setup
This commit is contained in:
@@ -2,7 +2,9 @@ import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
import deploy_tool.environment as environment_module
|
||||
from deploy_tool.environment import check_environment, load_tool_paths, save_tool_paths
|
||||
|
||||
|
||||
@@ -98,6 +100,18 @@ class EnvironmentTests(unittest.TestCase):
|
||||
|
||||
self.assertEqual(loaded, {"MySQL": mysql})
|
||||
|
||||
def test_tomcat_command_receives_catalina_home(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
catalina = Path(tmp) / "apache-tomcat" / "bin" / "catalina.bat"
|
||||
catalina.parent.mkdir(parents=True)
|
||||
catalina.write_text("@echo off", encoding="utf-8")
|
||||
completed = subprocess.CompletedProcess([str(catalina), "version"], 0, "Tomcat", "")
|
||||
|
||||
with patch("deploy_tool.environment.subprocess.run", return_value=completed) as run:
|
||||
environment_module._run_command([str(catalina), "version"])
|
||||
|
||||
self.assertEqual(run.call_args.kwargs["env"]["CATALINA_HOME"], str(catalina.parent.parent))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user