mirror of
https://github.com/dredx/prole.git
synced 2026-09-24 18:44:33 +00:00
- Add build-context helper to copy Docker context safely (ignore runtime data, keep symlinks) - Update UI and core actions to use ~/.prole/build and shared copy helper - Add/adjust tests and scripts; introduce knoe ops helpers and update manifests Co-authored-by: Junie <junie@jetbrains.com>
97 lines
2.6 KiB
Python
97 lines
2.6 KiB
Python
from __future__ import annotations
|
|
|
|
|
|
def test_render_argocd_config_page_smoke(monkeypatch):
|
|
"""Regression test: ArgoCD config page should render without missing-method errors.
|
|
|
|
We intentionally stub `tkinter` widgets and the canvas so this test can run headless.
|
|
"""
|
|
|
|
import knoe.ui.screens.argocd as argocd
|
|
from knoe.ui.screens.base import ScreenBaseMixin
|
|
|
|
class _DummyWidget:
|
|
def __init__(self, *_args, **_kwargs):
|
|
pass
|
|
|
|
def destroy(self):
|
|
return None
|
|
|
|
def place_forget(self):
|
|
return None
|
|
|
|
def configure(self, **_kwargs):
|
|
return None
|
|
|
|
class _DummyVar:
|
|
def __init__(self, value=None):
|
|
self._value = value
|
|
self._traces: list[callable] = []
|
|
|
|
def get(self):
|
|
return self._value
|
|
|
|
def set(self, value):
|
|
self._value = value
|
|
for cb in list(self._traces):
|
|
cb()
|
|
|
|
def trace_add(self, _mode: str, cb):
|
|
# The real tkinter passes (name, index, op); our callbacks accept *_.
|
|
self._traces.append(lambda: cb(None, None, None))
|
|
|
|
monkeypatch.setattr(argocd.tk, "Checkbutton", _DummyWidget)
|
|
monkeypatch.setattr(argocd.tk, "Entry", _DummyWidget)
|
|
monkeypatch.setattr(argocd.tk, "Button", _DummyWidget)
|
|
monkeypatch.setattr(argocd.tk, "StringVar", _DummyVar)
|
|
|
|
class _DummyCanvas:
|
|
def __init__(self):
|
|
self._next_id = 1
|
|
|
|
def winfo_width(self):
|
|
return 975
|
|
|
|
def create_text(self, *_args, **_kwargs):
|
|
item = self._next_id
|
|
self._next_id += 1
|
|
return item
|
|
|
|
def create_window(self, *_args, **_kwargs):
|
|
item = self._next_id
|
|
self._next_id += 1
|
|
return item
|
|
|
|
def itemconfig(self, *_args, **_kwargs):
|
|
return None
|
|
|
|
class _DummyConsole:
|
|
def write(self, _content: str):
|
|
return None
|
|
|
|
def clear(self):
|
|
return None
|
|
|
|
class _DummyApp(ScreenBaseMixin, argocd.ArgoCDScreenMixin):
|
|
def __init__(self):
|
|
self.bg_canvas = _DummyCanvas()
|
|
self._canvas_items: list[int] = []
|
|
self._overlay_widgets: list[object] = []
|
|
self.argocd_enabled = _DummyVar(False)
|
|
self.argocd_namespace = _DummyVar("argocd")
|
|
|
|
def _create_console_output(self, *_args, **_kwargs):
|
|
return _DummyConsole()
|
|
|
|
def update_footer(self):
|
|
return None
|
|
|
|
def _on_argocd_toggle(self):
|
|
return None
|
|
|
|
app = _DummyApp()
|
|
app._render_argocd_config_page()
|
|
|
|
assert app._canvas_items
|
|
assert app._overlay_widgets
|