Tower: upload cetmix_tower_aws 18.0.1.0.1 (was 18.0.1.0.1, via marketplace)

This commit is contained in:
2026-05-03 18:54:19 +00:00
parent d4789aaed6
commit e40caa55e8
20 changed files with 1444 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import test_boto3_integration

View File

@@ -0,0 +1,64 @@
# Copyright 2024 Cetmix OÜ
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.tests import common
class TestBoto3Integration(common.TransactionCase):
"""Test boto3 integration with Cetmix Tower commands."""
def setUp(self):
super().setUp()
# Create a test command
self.command = self.env["cx.tower.command"].create(
{
"name": "Test AWS Command",
"action": "python_code",
}
)
self.eval_context = self.env[
"cx.tower.command"
]._get_python_command_eval_context()
def test_boto3_in_evaluation_context(self):
"""Test that boto3 is added to the evaluation context."""
# Get evaluation context
# Check if boto3 is in the evaluation context
self.assertIn("boto3", self.eval_context)
# Check available methods
boto3_obj = self.eval_context["boto3"]
self.assertTrue(hasattr(boto3_obj, "client"))
self.assertTrue(hasattr(boto3_obj, "resource"))
self.assertTrue(hasattr(boto3_obj, "Session"))
def test_boto3_in_evaluation_context_with_server(self):
"""Test that boto3 is added to the evaluation context
when server is provided."""
# Create a test server
test_server = self.env["cx.tower.server"].create(
{
"name": "Test AWS Server",
"reference": "test_aws_server",
"ip_v4_address": "localhost",
"ssh_username": "admin",
"ssh_password": "password",
"ssh_auth_mode": "p",
"host_key": "test_key",
}
)
# Get evaluation context with server
eval_context = self.env["cx.tower.command"]._get_python_command_eval_context(
server=test_server
)
# Check if boto3 is in the evaluation context
self.assertIn("boto3", eval_context)
# Check available methods
boto3_obj = eval_context["boto3"]
self.assertTrue(hasattr(boto3_obj, "client"))
self.assertTrue(hasattr(boto3_obj, "resource"))
self.assertTrue(hasattr(boto3_obj, "Session"))
# Verify server is correctly passed to the context
self.assertEqual(eval_context["server"], test_server)