refactor: Major upgrade to v5.1b6 - AWS SSM support & Distributed Architecture
Core & Protocols: - Native AWS SSM support added (aws ssm start-session). - Improved Pexpect logic for ssm, kubectl, and docker. - Cleaned connection success messages (omitting ports for non-IP protocols). gRPC Layer: - Migrated gRPC modules to 'connpy/grpc_layer/'. - Implemented dynamic node naming (e.g. ssm-i-xxxx@aws) for accurate server-side logging. - Added automatic sys.path resolution for gRPC generated modules. - Enhanced InteractNode response with initial connection status. Printer & Concurrency: - Implemented ThreadLocalStream for isolated thread-safe output. - Self-healing Console objects to prevent 'closed file' errors in test/async environments. - Capture clean plugin output in remote executions. AI & Services: - Improved tool registration and debug visualization. - Restored native dictionary returns for AI tools to fix Web UI rendering. - Increased backup retention to 100 copies in SyncService. - Silenced noisy auto-sync CLI messages. Quality & Docs: - Total tests: 267 (all passing). - New test suites for gRPC layer and printer concurrency. - Updated .gitignore to exclude internal planning docs. - Full technical documentation regenerated with pdoc.
This commit is contained in:
1 parent
287acde1e4
commit
1c814eb9fd
94 files changed
+12656
-22613
No files matched your search
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.5">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.conftest API documentation</title>
|
||||
<meta name="description" content="Shared fixtures for connpy tests …">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
@@ -258,7 +258,7 @@ def tmp_config_dir(tmp_path):
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.5</a>.</p>
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.5">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests API documentation</title>
|
||||
<meta name="description" content="">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
@@ -72,6 +72,10 @@ el.replaceWith(d);
|
||||
<dd>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt><code class="name"><a title="connpy.tests.test_grpc_layer" href="test_grpc_layer.html">connpy.tests.test_grpc_layer</a></code></dt>
|
||||
<dd>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt><code class="name"><a title="connpy.tests.test_hooks" href="test_hooks.html">connpy.tests.test_hooks</a></code></dt>
|
||||
<dd>
|
||||
<div class="desc"><p>Tests for connpy.hooks module — MethodHook and ClassHook.</p></div>
|
||||
@@ -88,6 +92,10 @@ el.replaceWith(d);
|
||||
<dd>
|
||||
<div class="desc"><p>Tests for connpy.printer module.</p></div>
|
||||
</dd>
|
||||
<dt><code class="name"><a title="connpy.tests.test_printer_concurrency" href="test_printer_concurrency.html">connpy.tests.test_printer_concurrency</a></code></dt>
|
||||
<dd>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt><code class="name"><a title="connpy.tests.test_profile_service" href="test_profile_service.html">connpy.tests.test_profile_service</a></code></dt>
|
||||
<dd>
|
||||
<div class="desc"></div>
|
||||
@@ -129,10 +137,12 @@ el.replaceWith(d);
|
||||
<li><code><a title="connpy.tests.test_connapp" href="test_connapp.html">connpy.tests.test_connapp</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_core" href="test_core.html">connpy.tests.test_core</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_execution_service" href="test_execution_service.html">connpy.tests.test_execution_service</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_grpc_layer" href="test_grpc_layer.html">connpy.tests.test_grpc_layer</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_hooks" href="test_hooks.html">connpy.tests.test_hooks</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_node_service" href="test_node_service.html">connpy.tests.test_node_service</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_plugins" href="test_plugins.html">connpy.tests.test_plugins</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_printer" href="test_printer.html">connpy.tests.test_printer</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_printer_concurrency" href="test_printer_concurrency.html">connpy.tests.test_printer_concurrency</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_profile_service" href="test_profile_service.html">connpy.tests.test_profile_service</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_provider" href="test_provider.html">connpy.tests.test_provider</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_sync" href="test_sync.html">connpy.tests.test_sync</a></code></li>
|
||||
@@ -142,7 +152,7 @@ el.replaceWith(d);
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.5</a>.</p>
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.5">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.test_ai API documentation</title>
|
||||
<meta name="description" content="Tests for connpy.ai module.">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
@@ -1339,16 +1339,16 @@ def myai(self, ai_config, mock_litellm):
|
||||
|
||||
def test_list_nodes_tool_found(self, myai):
|
||||
result = myai.list_nodes_tool("router.*")
|
||||
parsed = json.loads(result)
|
||||
parsed = json.loads(result) if isinstance(result, str) else result
|
||||
assert "router1" in str(parsed)
|
||||
|
||||
def test_list_nodes_tool_not_found(self, myai):
|
||||
result = myai.list_nodes_tool("nonexistent_pattern_xyz")
|
||||
assert "No nodes found" in result
|
||||
assert "No nodes found" in str(result)
|
||||
|
||||
def test_get_node_info_masks_password(self, myai):
|
||||
result = myai.get_node_info_tool("router1")
|
||||
parsed = json.loads(result)
|
||||
parsed = json.loads(result) if isinstance(result, str) else result
|
||||
assert parsed["password"] == "***"
|
||||
|
||||
def test_is_safe_command_show(self, myai):
|
||||
@@ -1393,7 +1393,7 @@ def myai(self, ai_config, mock_litellm):
|
||||
</summary>
|
||||
<pre><code class="python">def test_get_node_info_masks_password(self, myai):
|
||||
result = myai.get_node_info_tool("router1")
|
||||
parsed = json.loads(result)
|
||||
parsed = json.loads(result) if isinstance(result, str) else result
|
||||
assert parsed["password"] == "***"</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
@@ -1462,7 +1462,7 @@ def myai(self, ai_config, mock_litellm):
|
||||
</summary>
|
||||
<pre><code class="python">def test_list_nodes_tool_found(self, myai):
|
||||
result = myai.list_nodes_tool("router.*")
|
||||
parsed = json.loads(result)
|
||||
parsed = json.loads(result) if isinstance(result, str) else result
|
||||
assert "router1" in str(parsed)</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
@@ -1477,7 +1477,7 @@ def myai(self, ai_config, mock_litellm):
|
||||
</summary>
|
||||
<pre><code class="python">def test_list_nodes_tool_not_found(self, myai):
|
||||
result = myai.list_nodes_tool("nonexistent_pattern_xyz")
|
||||
assert "No nodes found" in result</code></pre>
|
||||
assert "No nodes found" in str(result)</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
@@ -1731,7 +1731,7 @@ def myai(self, ai_config, mock_litellm):
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.5</a>.</p>
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.5">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.test_capture API documentation</title>
|
||||
<meta name="description" content="Tests for connpy.core_plugins.capture">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
@@ -245,7 +245,7 @@ def mock_connapp():
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.5</a>.</p>
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.5">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.test_completion API documentation</title>
|
||||
<meta name="description" content="Tests for connpy.completion module.">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
@@ -257,7 +257,7 @@ el.replaceWith(d);
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.5</a>.</p>
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.5">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.test_configfile API documentation</title>
|
||||
<meta name="description" content="Tests for connpy.configfile module.">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
@@ -2005,7 +2005,7 @@ el.replaceWith(d);
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.5</a>.</p>
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.5">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.test_connapp API documentation</title>
|
||||
<meta name="description" content="">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
@@ -699,7 +699,7 @@ def test_run(mock_run_commands, app):
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.5</a>.</p>
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.5">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.test_core API documentation</title>
|
||||
<meta name="description" content="Tests for connpy.core module — node and nodes classes.">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
@@ -93,6 +93,23 @@ el.replaceWith(d);
|
||||
assert "telnet 10.0.0.1" in cmd
|
||||
assert "23" in cmd
|
||||
|
||||
def test_ssm_cmd_basic(self):
|
||||
n = self._make_node(protocol="ssm", host="i-12345")
|
||||
cmd = n._get_cmd()
|
||||
assert "aws ssm start-session" in cmd
|
||||
assert "--target i-12345" in cmd
|
||||
|
||||
def test_ssm_cmd_tags(self):
|
||||
n = self._make_node(protocol="ssm", host="i-12345", tags={"region": "us-west-2", "profile": "prod"})
|
||||
cmd = n._get_cmd()
|
||||
assert "--region us-west-2" in cmd
|
||||
assert "--profile prod" in cmd
|
||||
|
||||
def test_ssm_cmd_options(self):
|
||||
n = self._make_node(protocol="ssm", host="i-12345", options="--document-name AWS-StartInteractiveCommand")
|
||||
cmd = n._get_cmd()
|
||||
assert "--document-name AWS-StartInteractiveCommand" in cmd
|
||||
|
||||
def test_kubectl_cmd(self):
|
||||
n = self._make_node(protocol="kubectl", host="my-pod", tags={"kube_command": "/bin/sh"})
|
||||
cmd = n._get_cmd()
|
||||
@@ -271,6 +288,53 @@ el.replaceWith(d);
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_core.TestCommandGeneration.test_ssm_cmd_basic"><code class="name flex">
|
||||
<span>def <span class="ident">test_ssm_cmd_basic</span></span>(<span>self)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def test_ssm_cmd_basic(self):
|
||||
n = self._make_node(protocol="ssm", host="i-12345")
|
||||
cmd = n._get_cmd()
|
||||
assert "aws ssm start-session" in cmd
|
||||
assert "--target i-12345" in cmd</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_core.TestCommandGeneration.test_ssm_cmd_options"><code class="name flex">
|
||||
<span>def <span class="ident">test_ssm_cmd_options</span></span>(<span>self)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def test_ssm_cmd_options(self):
|
||||
n = self._make_node(protocol="ssm", host="i-12345", options="--document-name AWS-StartInteractiveCommand")
|
||||
cmd = n._get_cmd()
|
||||
assert "--document-name AWS-StartInteractiveCommand" in cmd</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_core.TestCommandGeneration.test_ssm_cmd_tags"><code class="name flex">
|
||||
<span>def <span class="ident">test_ssm_cmd_tags</span></span>(<span>self)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def test_ssm_cmd_tags(self):
|
||||
n = self._make_node(protocol="ssm", host="i-12345", tags={"region": "us-west-2", "profile": "prod"})
|
||||
cmd = n._get_cmd()
|
||||
assert "--region us-west-2" in cmd
|
||||
assert "--profile prod" in cmd</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_core.TestCommandGeneration.test_telnet_cmd"><code class="name flex">
|
||||
<span>def <span class="ident">test_telnet_cmd</span></span>(<span>self)</span>
|
||||
</code></dt>
|
||||
@@ -1239,6 +1303,9 @@ el.replaceWith(d);
|
||||
<li><code><a title="connpy.tests.test_core.TestCommandGeneration.test_ssh_cmd_no_user" href="#connpy.tests.test_core.TestCommandGeneration.test_ssh_cmd_no_user">test_ssh_cmd_no_user</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_core.TestCommandGeneration.test_ssh_cmd_options" href="#connpy.tests.test_core.TestCommandGeneration.test_ssh_cmd_options">test_ssh_cmd_options</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_core.TestCommandGeneration.test_ssh_cmd_port" href="#connpy.tests.test_core.TestCommandGeneration.test_ssh_cmd_port">test_ssh_cmd_port</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_core.TestCommandGeneration.test_ssm_cmd_basic" href="#connpy.tests.test_core.TestCommandGeneration.test_ssm_cmd_basic">test_ssm_cmd_basic</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_core.TestCommandGeneration.test_ssm_cmd_options" href="#connpy.tests.test_core.TestCommandGeneration.test_ssm_cmd_options">test_ssm_cmd_options</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_core.TestCommandGeneration.test_ssm_cmd_tags" href="#connpy.tests.test_core.TestCommandGeneration.test_ssm_cmd_tags">test_ssm_cmd_tags</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_core.TestCommandGeneration.test_telnet_cmd" href="#connpy.tests.test_core.TestCommandGeneration.test_telnet_cmd">test_telnet_cmd</a></code></li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -1302,7 +1369,7 @@ el.replaceWith(d);
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.5</a>.</p>
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.5">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.test_execution_service API documentation</title>
|
||||
<meta name="description" content="">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
@@ -142,7 +142,7 @@ Regression: ExecutionService.test_commands currently ignores on_node_complete.</
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.5</a>.</p>
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,715 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.test_grpc_layer API documentation</title>
|
||||
<meta name="description" content="">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/typography.min.css" integrity="sha512-Y1DYSb995BAfxobCkKepB1BqJJTPrOp3zPL74AWFugHHmmdcvO+C48WLrUOlhGMc0QG7AE3f7gmvvcrmX2fDoA==" crossorigin>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css" crossorigin>
|
||||
<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:1.5em;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:2em 0 .50em 0}h3{font-size:1.4em;margin:1.6em 0 .7em 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .2s ease-in-out}a:visited{color:#503}a:hover{color:#b62}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900;font-weight:bold}pre code{font-size:.8em;line-height:1.4em;padding:1em;display:block}code{background:#f3f3f3;font-family:"DejaVu Sans Mono",monospace;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source > summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible;min-width:max-content}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em 1em;margin:1em 0}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
|
||||
<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul ul{padding-left:1em}.toc > ul > li{margin-top:.5em}}</style>
|
||||
<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
|
||||
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" integrity="sha512-D9gUyxqja7hBtkWpPWGt9wfbfaMGVt9gnyCvYa+jojwwPHLCzUm5i8rpk7vD7wNee9bA35eYIjobYPaQuKS1MQ==" crossorigin></script>
|
||||
<script>window.addEventListener('DOMContentLoaded', () => {
|
||||
hljs.configure({languages: ['bash', 'css', 'diff', 'graphql', 'ini', 'javascript', 'json', 'plaintext', 'python', 'python-repl', 'rust', 'shell', 'sql', 'typescript', 'xml', 'yaml']});
|
||||
hljs.highlightAll();
|
||||
/* Collapse source docstrings */
|
||||
setTimeout(() => {
|
||||
[...document.querySelectorAll('.hljs.language-python > .hljs-string')]
|
||||
.filter(el => el.innerHTML.length > 200 && ['"""', "'''"].includes(el.innerHTML.substring(0, 3)))
|
||||
.forEach(el => {
|
||||
let d = document.createElement('details');
|
||||
d.classList.add('hljs-string');
|
||||
d.innerHTML = '<summary>"""</summary>' + el.innerHTML.substring(3);
|
||||
el.replaceWith(d);
|
||||
});
|
||||
}, 100);
|
||||
})</script>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<article id="content">
|
||||
<header>
|
||||
<h1 class="title">Module <code>connpy.tests.test_grpc_layer</code></h1>
|
||||
</header>
|
||||
<section id="section-intro">
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
<section>
|
||||
<h2 class="section-title" id="header-classes">Classes</h2>
|
||||
<dl>
|
||||
<dt id="connpy.tests.test_grpc_layer.MockContext"><code class="flex name class">
|
||||
<span>class <span class="ident">MockContext</span></span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">class MockContext:
|
||||
def abort(self, code, details):
|
||||
raise Exception(f"gRPC Abort: {code} - {details}")</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
<h3>Methods</h3>
|
||||
<dl>
|
||||
<dt id="connpy.tests.test_grpc_layer.MockContext.abort"><code class="name flex">
|
||||
<span>def <span class="ident">abort</span></span>(<span>self, code, details)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def abort(self, code, details):
|
||||
raise Exception(f"gRPC Abort: {code} - {details}")</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestGRPCIntegration"><code class="flex name class">
|
||||
<span>class <span class="ident">TestGRPCIntegration</span></span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">class TestGRPCIntegration:
|
||||
@pytest.fixture
|
||||
def grpc_server(self, populated_config):
|
||||
"""Starts a local gRPC server for integration testing."""
|
||||
srv = grpc.server(futures.ThreadPoolExecutor(max_workers=5))
|
||||
|
||||
# Register services
|
||||
connpy_pb2_grpc.add_NodeServiceServicer_to_server(server.NodeServicer(populated_config), srv)
|
||||
connpy_pb2_grpc.add_ProfileServiceServicer_to_server(server.ProfileServicer(populated_config), srv)
|
||||
connpy_pb2_grpc.add_ConfigServiceServicer_to_server(server.ConfigServicer(populated_config), srv)
|
||||
connpy_pb2_grpc.add_ExecutionServiceServicer_to_server(server.ExecutionServicer(populated_config), srv)
|
||||
connpy_pb2_grpc.add_ImportExportServiceServicer_to_server(server.ImportExportServicer(populated_config), srv)
|
||||
|
||||
port = srv.add_insecure_port('127.0.0.1:0')
|
||||
srv.start()
|
||||
yield f"127.0.0.1:{port}"
|
||||
srv.stop(0)
|
||||
|
||||
@pytest.fixture
|
||||
def channel(self, grpc_server):
|
||||
with grpc.insecure_channel(grpc_server) as channel:
|
||||
yield channel
|
||||
|
||||
@pytest.fixture
|
||||
def node_stub(self, channel):
|
||||
return stubs.NodeStub(channel, "localhost")
|
||||
|
||||
@pytest.fixture
|
||||
def profile_stub(self, channel):
|
||||
return stubs.ProfileStub(channel, "localhost")
|
||||
|
||||
@pytest.fixture
|
||||
def config_stub(self, channel):
|
||||
return stubs.ConfigStub(channel, "localhost")
|
||||
|
||||
def test_list_nodes_integration(self, node_stub):
|
||||
nodes = node_stub.list_nodes()
|
||||
assert "router1" in nodes
|
||||
assert "server1@office" in nodes
|
||||
|
||||
def test_get_node_details_integration(self, node_stub):
|
||||
details = node_stub.get_node_details("router1")
|
||||
assert details["host"] == "10.0.0.1"
|
||||
|
||||
def test_node_not_found_integration(self, node_stub):
|
||||
with pytest.raises(ConnpyError) as exc:
|
||||
node_stub.get_node_details("non-existent")
|
||||
assert "Node 'non-existent' not found." in str(exc.value)
|
||||
|
||||
def test_list_profiles_integration(self, profile_stub):
|
||||
profiles = profile_stub.list_profiles()
|
||||
assert "office-user" in profiles
|
||||
|
||||
def test_get_settings_integration(self, config_stub):
|
||||
settings = config_stub.get_settings()
|
||||
assert "idletime" in settings
|
||||
|
||||
def test_update_setting_integration(self, config_stub):
|
||||
config_stub.update_setting("idletime", 99)
|
||||
settings = config_stub.get_settings()
|
||||
assert settings["idletime"] == 99
|
||||
|
||||
def test_add_delete_node_integration(self, node_stub):
|
||||
node_stub.add_node("integration-test-node", {"host": "9.9.9.9"})
|
||||
assert "integration-test-node" in node_stub.list_nodes()
|
||||
node_stub.delete_node("integration-test-node")
|
||||
assert "integration-test-node" not in node_stub.list_nodes()
|
||||
|
||||
def test_import_yaml_integration(self, channel, node_stub):
|
||||
import yaml
|
||||
from connpy.grpc_layer import stubs
|
||||
stub = stubs.ImportExportStub(channel, "localhost")
|
||||
|
||||
# ImportExportService expects a flat dict of nodes, not a full config structure
|
||||
inventory = {
|
||||
"imported-node": {"host": "8.8.8.8", "protocol": "ssh", "type": "connection"}
|
||||
}
|
||||
yaml_content = yaml.dump(inventory)
|
||||
|
||||
import tempfile
|
||||
with tempfile.NamedTemporaryFile(mode="w", suffix=".yaml", delete=False) as f:
|
||||
f.write(yaml_content)
|
||||
temp_path = f.name
|
||||
|
||||
try:
|
||||
stub.import_from_file(temp_path)
|
||||
# Verify the node was imported and is visible via NodeStub
|
||||
nodes = node_stub.list_nodes()
|
||||
assert "imported-node" in nodes
|
||||
finally:
|
||||
if os.path.exists(temp_path):
|
||||
os.remove(temp_path)</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
<h3>Methods</h3>
|
||||
<dl>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestGRPCIntegration.channel"><code class="name flex">
|
||||
<span>def <span class="ident">channel</span></span>(<span>self, grpc_server)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">@pytest.fixture
|
||||
def channel(self, grpc_server):
|
||||
with grpc.insecure_channel(grpc_server) as channel:
|
||||
yield channel</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestGRPCIntegration.config_stub"><code class="name flex">
|
||||
<span>def <span class="ident">config_stub</span></span>(<span>self, channel)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">@pytest.fixture
|
||||
def config_stub(self, channel):
|
||||
return stubs.ConfigStub(channel, "localhost")</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestGRPCIntegration.grpc_server"><code class="name flex">
|
||||
<span>def <span class="ident">grpc_server</span></span>(<span>self, populated_config)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">@pytest.fixture
|
||||
def grpc_server(self, populated_config):
|
||||
"""Starts a local gRPC server for integration testing."""
|
||||
srv = grpc.server(futures.ThreadPoolExecutor(max_workers=5))
|
||||
|
||||
# Register services
|
||||
connpy_pb2_grpc.add_NodeServiceServicer_to_server(server.NodeServicer(populated_config), srv)
|
||||
connpy_pb2_grpc.add_ProfileServiceServicer_to_server(server.ProfileServicer(populated_config), srv)
|
||||
connpy_pb2_grpc.add_ConfigServiceServicer_to_server(server.ConfigServicer(populated_config), srv)
|
||||
connpy_pb2_grpc.add_ExecutionServiceServicer_to_server(server.ExecutionServicer(populated_config), srv)
|
||||
connpy_pb2_grpc.add_ImportExportServiceServicer_to_server(server.ImportExportServicer(populated_config), srv)
|
||||
|
||||
port = srv.add_insecure_port('127.0.0.1:0')
|
||||
srv.start()
|
||||
yield f"127.0.0.1:{port}"
|
||||
srv.stop(0)</code></pre>
|
||||
</details>
|
||||
<div class="desc"><p>Starts a local gRPC server for integration testing.</p></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestGRPCIntegration.node_stub"><code class="name flex">
|
||||
<span>def <span class="ident">node_stub</span></span>(<span>self, channel)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">@pytest.fixture
|
||||
def node_stub(self, channel):
|
||||
return stubs.NodeStub(channel, "localhost")</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestGRPCIntegration.profile_stub"><code class="name flex">
|
||||
<span>def <span class="ident">profile_stub</span></span>(<span>self, channel)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">@pytest.fixture
|
||||
def profile_stub(self, channel):
|
||||
return stubs.ProfileStub(channel, "localhost")</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestGRPCIntegration.test_add_delete_node_integration"><code class="name flex">
|
||||
<span>def <span class="ident">test_add_delete_node_integration</span></span>(<span>self, node_stub)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def test_add_delete_node_integration(self, node_stub):
|
||||
node_stub.add_node("integration-test-node", {"host": "9.9.9.9"})
|
||||
assert "integration-test-node" in node_stub.list_nodes()
|
||||
node_stub.delete_node("integration-test-node")
|
||||
assert "integration-test-node" not in node_stub.list_nodes()</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestGRPCIntegration.test_get_node_details_integration"><code class="name flex">
|
||||
<span>def <span class="ident">test_get_node_details_integration</span></span>(<span>self, node_stub)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def test_get_node_details_integration(self, node_stub):
|
||||
details = node_stub.get_node_details("router1")
|
||||
assert details["host"] == "10.0.0.1"</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestGRPCIntegration.test_get_settings_integration"><code class="name flex">
|
||||
<span>def <span class="ident">test_get_settings_integration</span></span>(<span>self, config_stub)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def test_get_settings_integration(self, config_stub):
|
||||
settings = config_stub.get_settings()
|
||||
assert "idletime" in settings</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestGRPCIntegration.test_import_yaml_integration"><code class="name flex">
|
||||
<span>def <span class="ident">test_import_yaml_integration</span></span>(<span>self, channel, node_stub)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def test_import_yaml_integration(self, channel, node_stub):
|
||||
import yaml
|
||||
from connpy.grpc_layer import stubs
|
||||
stub = stubs.ImportExportStub(channel, "localhost")
|
||||
|
||||
# ImportExportService expects a flat dict of nodes, not a full config structure
|
||||
inventory = {
|
||||
"imported-node": {"host": "8.8.8.8", "protocol": "ssh", "type": "connection"}
|
||||
}
|
||||
yaml_content = yaml.dump(inventory)
|
||||
|
||||
import tempfile
|
||||
with tempfile.NamedTemporaryFile(mode="w", suffix=".yaml", delete=False) as f:
|
||||
f.write(yaml_content)
|
||||
temp_path = f.name
|
||||
|
||||
try:
|
||||
stub.import_from_file(temp_path)
|
||||
# Verify the node was imported and is visible via NodeStub
|
||||
nodes = node_stub.list_nodes()
|
||||
assert "imported-node" in nodes
|
||||
finally:
|
||||
if os.path.exists(temp_path):
|
||||
os.remove(temp_path)</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestGRPCIntegration.test_list_nodes_integration"><code class="name flex">
|
||||
<span>def <span class="ident">test_list_nodes_integration</span></span>(<span>self, node_stub)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def test_list_nodes_integration(self, node_stub):
|
||||
nodes = node_stub.list_nodes()
|
||||
assert "router1" in nodes
|
||||
assert "server1@office" in nodes</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestGRPCIntegration.test_list_profiles_integration"><code class="name flex">
|
||||
<span>def <span class="ident">test_list_profiles_integration</span></span>(<span>self, profile_stub)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def test_list_profiles_integration(self, profile_stub):
|
||||
profiles = profile_stub.list_profiles()
|
||||
assert "office-user" in profiles</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestGRPCIntegration.test_node_not_found_integration"><code class="name flex">
|
||||
<span>def <span class="ident">test_node_not_found_integration</span></span>(<span>self, node_stub)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def test_node_not_found_integration(self, node_stub):
|
||||
with pytest.raises(ConnpyError) as exc:
|
||||
node_stub.get_node_details("non-existent")
|
||||
assert "Node 'non-existent' not found." in str(exc.value)</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestGRPCIntegration.test_update_setting_integration"><code class="name flex">
|
||||
<span>def <span class="ident">test_update_setting_integration</span></span>(<span>self, config_stub)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def test_update_setting_integration(self, config_stub):
|
||||
config_stub.update_setting("idletime", 99)
|
||||
settings = config_stub.get_settings()
|
||||
assert settings["idletime"] == 99</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestNodeServicerNaming"><code class="flex name class">
|
||||
<span>class <span class="ident">TestNodeServicerNaming</span></span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">class TestNodeServicerNaming:
|
||||
@pytest.fixture
|
||||
def servicer(self, populated_config):
|
||||
return server.NodeServicer(populated_config)
|
||||
|
||||
@patch("connpy.core.node")
|
||||
def test_interact_node_uses_passed_name(self, mock_node, servicer):
|
||||
# Setup request with custom name
|
||||
params = {"name": "custom-node-name@test", "host": "1.2.3.4", "protocol": "ssh"}
|
||||
request = connpy_pb2.InteractRequest(
|
||||
id="dynamic",
|
||||
connection_params_json=json.dumps(params)
|
||||
)
|
||||
|
||||
# Mock node to allow _connect
|
||||
mock_node_instance = MagicMock()
|
||||
mock_node_instance._connect.return_value = True
|
||||
mock_node.return_value = mock_node_instance
|
||||
|
||||
# We only need the first iteration of the generator to check naming
|
||||
gen = servicer.interact_node(iter([request]), MockContext())
|
||||
next(gen) # Skip the success response
|
||||
|
||||
# Verify that node() was called with the custom name
|
||||
mock_node.assert_called()
|
||||
found = False
|
||||
for call in mock_node.call_args_list:
|
||||
if call.args[0] == "custom-node-name@test":
|
||||
found = True
|
||||
break
|
||||
assert found
|
||||
|
||||
@patch("connpy.core.node")
|
||||
def test_interact_node_fallback_naming(self, mock_node, servicer):
|
||||
# Setup request without custom name but with host
|
||||
params = {"host": "my-instance", "protocol": "ssm"}
|
||||
request = connpy_pb2.InteractRequest(
|
||||
id="dynamic",
|
||||
connection_params_json=json.dumps(params)
|
||||
)
|
||||
|
||||
mock_node_instance = MagicMock()
|
||||
mock_node_instance._connect.return_value = True
|
||||
mock_node.return_value = mock_node_instance
|
||||
|
||||
gen = servicer.interact_node(iter([request]), MockContext())
|
||||
next(gen)
|
||||
|
||||
# Verify fallback name: dynamic-{host}@remote
|
||||
found = False
|
||||
for call in mock_node.call_args_list:
|
||||
if call.args[0] == "dynamic-my-instance@remote":
|
||||
found = True
|
||||
break
|
||||
assert found</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
<h3>Methods</h3>
|
||||
<dl>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestNodeServicerNaming.servicer"><code class="name flex">
|
||||
<span>def <span class="ident">servicer</span></span>(<span>self, populated_config)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">@pytest.fixture
|
||||
def servicer(self, populated_config):
|
||||
return server.NodeServicer(populated_config)</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestNodeServicerNaming.test_interact_node_fallback_naming"><code class="name flex">
|
||||
<span>def <span class="ident">test_interact_node_fallback_naming</span></span>(<span>self, mock_node, servicer)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">@patch("connpy.core.node")
|
||||
def test_interact_node_fallback_naming(self, mock_node, servicer):
|
||||
# Setup request without custom name but with host
|
||||
params = {"host": "my-instance", "protocol": "ssm"}
|
||||
request = connpy_pb2.InteractRequest(
|
||||
id="dynamic",
|
||||
connection_params_json=json.dumps(params)
|
||||
)
|
||||
|
||||
mock_node_instance = MagicMock()
|
||||
mock_node_instance._connect.return_value = True
|
||||
mock_node.return_value = mock_node_instance
|
||||
|
||||
gen = servicer.interact_node(iter([request]), MockContext())
|
||||
next(gen)
|
||||
|
||||
# Verify fallback name: dynamic-{host}@remote
|
||||
found = False
|
||||
for call in mock_node.call_args_list:
|
||||
if call.args[0] == "dynamic-my-instance@remote":
|
||||
found = True
|
||||
break
|
||||
assert found</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestNodeServicerNaming.test_interact_node_uses_passed_name"><code class="name flex">
|
||||
<span>def <span class="ident">test_interact_node_uses_passed_name</span></span>(<span>self, mock_node, servicer)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">@patch("connpy.core.node")
|
||||
def test_interact_node_uses_passed_name(self, mock_node, servicer):
|
||||
# Setup request with custom name
|
||||
params = {"name": "custom-node-name@test", "host": "1.2.3.4", "protocol": "ssh"}
|
||||
request = connpy_pb2.InteractRequest(
|
||||
id="dynamic",
|
||||
connection_params_json=json.dumps(params)
|
||||
)
|
||||
|
||||
# Mock node to allow _connect
|
||||
mock_node_instance = MagicMock()
|
||||
mock_node_instance._connect.return_value = True
|
||||
mock_node.return_value = mock_node_instance
|
||||
|
||||
# We only need the first iteration of the generator to check naming
|
||||
gen = servicer.interact_node(iter([request]), MockContext())
|
||||
next(gen) # Skip the success response
|
||||
|
||||
# Verify that node() was called with the custom name
|
||||
mock_node.assert_called()
|
||||
found = False
|
||||
for call in mock_node.call_args_list:
|
||||
if call.args[0] == "custom-node-name@test":
|
||||
found = True
|
||||
break
|
||||
assert found</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestStubsMessageFormatting"><code class="flex name class">
|
||||
<span>class <span class="ident">TestStubsMessageFormatting</span></span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">class TestStubsMessageFormatting:
|
||||
@patch("termios.tcsetattr")
|
||||
@patch("termios.tcgetattr")
|
||||
@patch("tty.setraw")
|
||||
@patch("os.read")
|
||||
@patch("select.select")
|
||||
def test_connect_dynamic_msg_formatting_ssm(self, mock_select, mock_read, mock_setraw, mock_getattr, mock_setattr):
|
||||
from connpy.grpc_layer.stubs import NodeStub
|
||||
|
||||
mock_getattr.return_value = [0, 0, 0, 0, 0, 0, [0] * 32]
|
||||
mock_channel = MagicMock()
|
||||
stub = NodeStub(mock_channel, "localhost:8048")
|
||||
|
||||
mock_resp = MagicMock()
|
||||
mock_resp.success = True
|
||||
stub.stub.interact_node.return_value = iter([mock_resp])
|
||||
|
||||
with patch("connpy.printer.success") as mock_success:
|
||||
with patch("sys.stdin.fileno", return_value=0):
|
||||
mock_select.return_value = ([], [], [])
|
||||
params = {"protocol": "ssm", "host": "i-12345", "name": "my-ssm-node@aws"}
|
||||
|
||||
with patch("select.select", side_effect=KeyboardInterrupt):
|
||||
try:
|
||||
stub.connect_dynamic(params)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
mock_success.assert_called()
|
||||
msg = mock_success.call_args[0][0]
|
||||
assert "Connected to my-ssm-node@aws" in msg
|
||||
assert "at i-12345" in msg
|
||||
assert ":22" not in msg
|
||||
assert "via: ssm" in msg</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
<h3>Methods</h3>
|
||||
<dl>
|
||||
<dt id="connpy.tests.test_grpc_layer.TestStubsMessageFormatting.test_connect_dynamic_msg_formatting_ssm"><code class="name flex">
|
||||
<span>def <span class="ident">test_connect_dynamic_msg_formatting_ssm</span></span>(<span>self, mock_select, mock_read, mock_setraw, mock_getattr, mock_setattr)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">@patch("termios.tcsetattr")
|
||||
@patch("termios.tcgetattr")
|
||||
@patch("tty.setraw")
|
||||
@patch("os.read")
|
||||
@patch("select.select")
|
||||
def test_connect_dynamic_msg_formatting_ssm(self, mock_select, mock_read, mock_setraw, mock_getattr, mock_setattr):
|
||||
from connpy.grpc_layer.stubs import NodeStub
|
||||
|
||||
mock_getattr.return_value = [0, 0, 0, 0, 0, 0, [0] * 32]
|
||||
mock_channel = MagicMock()
|
||||
stub = NodeStub(mock_channel, "localhost:8048")
|
||||
|
||||
mock_resp = MagicMock()
|
||||
mock_resp.success = True
|
||||
stub.stub.interact_node.return_value = iter([mock_resp])
|
||||
|
||||
with patch("connpy.printer.success") as mock_success:
|
||||
with patch("sys.stdin.fileno", return_value=0):
|
||||
mock_select.return_value = ([], [], [])
|
||||
params = {"protocol": "ssm", "host": "i-12345", "name": "my-ssm-node@aws"}
|
||||
|
||||
with patch("select.select", side_effect=KeyboardInterrupt):
|
||||
try:
|
||||
stub.connect_dynamic(params)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
mock_success.assert_called()
|
||||
msg = mock_success.call_args[0][0]
|
||||
assert "Connected to my-ssm-node@aws" in msg
|
||||
assert "at i-12345" in msg
|
||||
assert ":22" not in msg
|
||||
assert "via: ssm" in msg</code></pre>
|
||||
</details>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
</article>
|
||||
<nav id="sidebar">
|
||||
<div class="toc">
|
||||
<ul></ul>
|
||||
</div>
|
||||
<ul id="index">
|
||||
<li><h3>Super-module</h3>
|
||||
<ul>
|
||||
<li><code><a title="connpy.tests" href="index.html">connpy.tests</a></code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><h3><a href="#header-classes">Classes</a></h3>
|
||||
<ul>
|
||||
<li>
|
||||
<h4><code><a title="connpy.tests.test_grpc_layer.MockContext" href="#connpy.tests.test_grpc_layer.MockContext">MockContext</a></code></h4>
|
||||
<ul class="">
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.MockContext.abort" href="#connpy.tests.test_grpc_layer.MockContext.abort">abort</a></code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<h4><code><a title="connpy.tests.test_grpc_layer.TestGRPCIntegration" href="#connpy.tests.test_grpc_layer.TestGRPCIntegration">TestGRPCIntegration</a></code></h4>
|
||||
<ul class="">
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestGRPCIntegration.channel" href="#connpy.tests.test_grpc_layer.TestGRPCIntegration.channel">channel</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestGRPCIntegration.config_stub" href="#connpy.tests.test_grpc_layer.TestGRPCIntegration.config_stub">config_stub</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestGRPCIntegration.grpc_server" href="#connpy.tests.test_grpc_layer.TestGRPCIntegration.grpc_server">grpc_server</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestGRPCIntegration.node_stub" href="#connpy.tests.test_grpc_layer.TestGRPCIntegration.node_stub">node_stub</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestGRPCIntegration.profile_stub" href="#connpy.tests.test_grpc_layer.TestGRPCIntegration.profile_stub">profile_stub</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestGRPCIntegration.test_add_delete_node_integration" href="#connpy.tests.test_grpc_layer.TestGRPCIntegration.test_add_delete_node_integration">test_add_delete_node_integration</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestGRPCIntegration.test_get_node_details_integration" href="#connpy.tests.test_grpc_layer.TestGRPCIntegration.test_get_node_details_integration">test_get_node_details_integration</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestGRPCIntegration.test_get_settings_integration" href="#connpy.tests.test_grpc_layer.TestGRPCIntegration.test_get_settings_integration">test_get_settings_integration</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestGRPCIntegration.test_import_yaml_integration" href="#connpy.tests.test_grpc_layer.TestGRPCIntegration.test_import_yaml_integration">test_import_yaml_integration</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestGRPCIntegration.test_list_nodes_integration" href="#connpy.tests.test_grpc_layer.TestGRPCIntegration.test_list_nodes_integration">test_list_nodes_integration</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestGRPCIntegration.test_list_profiles_integration" href="#connpy.tests.test_grpc_layer.TestGRPCIntegration.test_list_profiles_integration">test_list_profiles_integration</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestGRPCIntegration.test_node_not_found_integration" href="#connpy.tests.test_grpc_layer.TestGRPCIntegration.test_node_not_found_integration">test_node_not_found_integration</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestGRPCIntegration.test_update_setting_integration" href="#connpy.tests.test_grpc_layer.TestGRPCIntegration.test_update_setting_integration">test_update_setting_integration</a></code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<h4><code><a title="connpy.tests.test_grpc_layer.TestNodeServicerNaming" href="#connpy.tests.test_grpc_layer.TestNodeServicerNaming">TestNodeServicerNaming</a></code></h4>
|
||||
<ul class="">
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestNodeServicerNaming.servicer" href="#connpy.tests.test_grpc_layer.TestNodeServicerNaming.servicer">servicer</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestNodeServicerNaming.test_interact_node_fallback_naming" href="#connpy.tests.test_grpc_layer.TestNodeServicerNaming.test_interact_node_fallback_naming">test_interact_node_fallback_naming</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestNodeServicerNaming.test_interact_node_uses_passed_name" href="#connpy.tests.test_grpc_layer.TestNodeServicerNaming.test_interact_node_uses_passed_name">test_interact_node_uses_passed_name</a></code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<h4><code><a title="connpy.tests.test_grpc_layer.TestStubsMessageFormatting" href="#connpy.tests.test_grpc_layer.TestStubsMessageFormatting">TestStubsMessageFormatting</a></code></h4>
|
||||
<ul class="">
|
||||
<li><code><a title="connpy.tests.test_grpc_layer.TestStubsMessageFormatting.test_connect_dynamic_msg_formatting_ssm" href="#connpy.tests.test_grpc_layer.TestStubsMessageFormatting.test_connect_dynamic_msg_formatting_ssm">test_connect_dynamic_msg_formatting_ssm</a></code></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.5">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.test_hooks API documentation</title>
|
||||
<meta name="description" content="Tests for connpy.hooks module — MethodHook and ClassHook.">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
@@ -673,7 +673,7 @@ el.replaceWith(d);
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.5</a>.</p>
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.5">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.test_node_service API documentation</title>
|
||||
<meta name="description" content="">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
@@ -178,7 +178,7 @@ Regression: connapp._mod calls add_node instead of update_node.</p></div>
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.5</a>.</p>
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.5">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.test_plugins API documentation</title>
|
||||
<meta name="description" content="Tests for connpy.plugins module.">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
@@ -917,7 +917,7 @@ el.replaceWith(d);
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.5</a>.</p>
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.5">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.test_printer API documentation</title>
|
||||
<meta name="description" content="Tests for connpy.printer module.">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
@@ -459,7 +459,7 @@ el.replaceWith(d);
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.5</a>.</p>
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,154 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.test_printer_concurrency API documentation</title>
|
||||
<meta name="description" content="">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/typography.min.css" integrity="sha512-Y1DYSb995BAfxobCkKepB1BqJJTPrOp3zPL74AWFugHHmmdcvO+C48WLrUOlhGMc0QG7AE3f7gmvvcrmX2fDoA==" crossorigin>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css" crossorigin>
|
||||
<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:1.5em;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:2em 0 .50em 0}h3{font-size:1.4em;margin:1.6em 0 .7em 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .2s ease-in-out}a:visited{color:#503}a:hover{color:#b62}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900;font-weight:bold}pre code{font-size:.8em;line-height:1.4em;padding:1em;display:block}code{background:#f3f3f3;font-family:"DejaVu Sans Mono",monospace;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source > summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible;min-width:max-content}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em 1em;margin:1em 0}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
|
||||
<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul ul{padding-left:1em}.toc > ul > li{margin-top:.5em}}</style>
|
||||
<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
|
||||
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" integrity="sha512-D9gUyxqja7hBtkWpPWGt9wfbfaMGVt9gnyCvYa+jojwwPHLCzUm5i8rpk7vD7wNee9bA35eYIjobYPaQuKS1MQ==" crossorigin></script>
|
||||
<script>window.addEventListener('DOMContentLoaded', () => {
|
||||
hljs.configure({languages: ['bash', 'css', 'diff', 'graphql', 'ini', 'javascript', 'json', 'plaintext', 'python', 'python-repl', 'rust', 'shell', 'sql', 'typescript', 'xml', 'yaml']});
|
||||
hljs.highlightAll();
|
||||
/* Collapse source docstrings */
|
||||
setTimeout(() => {
|
||||
[...document.querySelectorAll('.hljs.language-python > .hljs-string')]
|
||||
.filter(el => el.innerHTML.length > 200 && ['"""', "'''"].includes(el.innerHTML.substring(0, 3)))
|
||||
.forEach(el => {
|
||||
let d = document.createElement('details');
|
||||
d.classList.add('hljs-string');
|
||||
d.innerHTML = '<summary>"""</summary>' + el.innerHTML.substring(3);
|
||||
el.replaceWith(d);
|
||||
});
|
||||
}, 100);
|
||||
})</script>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<article id="content">
|
||||
<header>
|
||||
<h1 class="title">Module <code>connpy.tests.test_printer_concurrency</code></h1>
|
||||
</header>
|
||||
<section id="section-intro">
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
<section>
|
||||
<h2 class="section-title" id="header-functions">Functions</h2>
|
||||
<dl>
|
||||
<dt id="connpy.tests.test_printer_concurrency.test_printer_manual_stream"><code class="name flex">
|
||||
<span>def <span class="ident">test_printer_manual_stream</span></span>(<span>)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def test_printer_manual_stream():
|
||||
"""Verify that setting a thread stream correctly captures printer output in the current thread."""
|
||||
buf = io.StringIO()
|
||||
|
||||
# We must clear the thread-local console to force it to pick up the new sys.stdout proxy
|
||||
printer.set_thread_console(None)
|
||||
printer.set_thread_stream(buf)
|
||||
|
||||
printer.info("Captured-Message")
|
||||
|
||||
output = buf.getvalue()
|
||||
printer.set_thread_stream(None)
|
||||
printer.set_thread_console(None)
|
||||
|
||||
assert "Captured-Message" in output</code></pre>
|
||||
</details>
|
||||
<div class="desc"><p>Verify that setting a thread stream correctly captures printer output in the current thread.</p></div>
|
||||
</dd>
|
||||
<dt id="connpy.tests.test_printer_concurrency.test_printer_thread_isolation"><code class="name flex">
|
||||
<span>def <span class="ident">test_printer_thread_isolation</span></span>(<span>)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def test_printer_thread_isolation():
|
||||
"""Verify that printer output is isolated per thread when using set_thread_stream."""
|
||||
num_threads = 5
|
||||
iterations = 20
|
||||
results = {}
|
||||
|
||||
def worker(thread_id):
|
||||
# Create a private buffer for this thread
|
||||
buf = io.StringIO()
|
||||
printer.set_thread_stream(buf)
|
||||
|
||||
# Ensure we have a clean console for this thread
|
||||
# In a real gRPC request, this happens automatically as it's a new thread
|
||||
printer.set_thread_console(None)
|
||||
|
||||
# Each thread prints its own ID
|
||||
expected_msg = f"Thread-{thread_id}"
|
||||
for _ in range(iterations):
|
||||
printer.info(expected_msg)
|
||||
time.sleep(0.01)
|
||||
|
||||
results[thread_id] = buf.getvalue()
|
||||
printer.set_thread_stream(None)
|
||||
|
||||
threads = []
|
||||
for i in range(num_threads):
|
||||
t = threading.Thread(target=worker, args=(i,))
|
||||
threads.append(t)
|
||||
t.start()
|
||||
|
||||
for t in threads:
|
||||
t.join()
|
||||
|
||||
# Validation
|
||||
for thread_id, output in results.items():
|
||||
expected_msg = f"Thread-{thread_id}"
|
||||
assert expected_msg in output
|
||||
|
||||
# Ensure no leaks
|
||||
for other_id in range(num_threads):
|
||||
if other_id == thread_id: continue
|
||||
assert f"Thread-{other_id}" not in output</code></pre>
|
||||
</details>
|
||||
<div class="desc"><p>Verify that printer output is isolated per thread when using set_thread_stream.</p></div>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
</article>
|
||||
<nav id="sidebar">
|
||||
<div class="toc">
|
||||
<ul></ul>
|
||||
</div>
|
||||
<ul id="index">
|
||||
<li><h3>Super-module</h3>
|
||||
<ul>
|
||||
<li><code><a title="connpy.tests" href="index.html">connpy.tests</a></code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><h3><a href="#header-functions">Functions</a></h3>
|
||||
<ul class="">
|
||||
<li><code><a title="connpy.tests.test_printer_concurrency.test_printer_manual_stream" href="#connpy.tests.test_printer_concurrency.test_printer_manual_stream">test_printer_manual_stream</a></code></li>
|
||||
<li><code><a title="connpy.tests.test_printer_concurrency.test_printer_thread_isolation" href="#connpy.tests.test_printer_concurrency.test_printer_thread_isolation">test_printer_thread_isolation</a></code></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.5">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.test_profile_service API documentation</title>
|
||||
<meta name="description" content="">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
@@ -192,7 +192,7 @@ Regression: ProfileService currently doesn't resolve inheritance within profiles
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.5</a>.</p>
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.5">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.test_provider API documentation</title>
|
||||
<meta name="description" content="">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
@@ -139,7 +139,7 @@ el.replaceWith(d);
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.5</a>.</p>
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.5">
|
||||
<meta name="generator" content="pdoc3 0.11.6">
|
||||
<title>connpy.tests.test_sync API documentation</title>
|
||||
<meta name="description" content="Tests for connpy.services.sync_service">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
@@ -354,7 +354,7 @@ def test_perform_restore(self, mock_remove, mock_dirname, mock_exists, MockZipFi
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.5</a>.</p>
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user