Skip to content

feat: add smoke-test harness and CI (ruff + pytest)#62

Merged
ball42 merged 2 commits into
developfrom
test/smoke-harness
Jul 7, 2026
Merged

feat: add smoke-test harness and CI (ruff + pytest)#62
ball42 merged 2 commits into
developfrom
test/smoke-harness

Conversation

@ball42

@ball42 ball42 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces a full smoke-test suite for the JAWA web console and webhook receiver, along with the necessary configuration and fixtures to support isolated, reproducible testing. The suite requires no Jamf Pro server, network access, or root privileges, as all external dependencies are faked or stubbed. Additionally, the pull request sets up a CI workflow to run linting and tests across multiple Python versions, and adds configuration for pytest and ruff.

Test Suite and Fixtures

  • Added a comprehensive test suite under the tests/ directory, covering route rendering, webhook receiver logic, and login/logout flows, with all Jamf Pro and script execution calls faked or stubbed (tests/README.md, tests/conftest.py, tests/test_smoke_routes.py, tests/test_receiver.py, tests/test_login.py) [1] [2] [3] [4] [5].
  • Introduced shared fixtures in tests/conftest.py to redirect all module-level paths and external calls to per-test temporary directories and fake implementations, ensuring test isolation and no side effects (tests/conftest.py).

Continuous Integration and Tooling

  • Added a GitHub Actions workflow .github/workflows/ci.yml to run linting (ruff) and tests (pytest) on Python 3.9 and 3.14 for both pushes and pull requests (.github/workflows/ci.yml).
  • Added pytest.ini to configure test discovery and requirements-dev.txt to pin development dependencies (pytest, ruff) (pytest.ini, requirements-dev.txt) [1] [2].
  • Updated ruff.toml to exclude the data/workflows/scripts directory from linting (ruff.toml).

ball42 and others added 2 commits July 6, 2026 23:05
- Add GitHub Actions CI workflow with Python version matrix.
- Define shared pytest fixtures for isolated environments and Jamf API mocks.
- Introduce initial smoke tests for blueprints, webhooks, and login flows.
- Configure ruff and pytest; update dev dependencies.
Comment thread views/resource_view.py
)
return redirect(url_for("resources_view.files"))
try:
os.remove(os.path.join(files_dir, target_file))
Comment thread views/template_view.py
"""Install a .jawa.json workflow package into JAWA."""
script = package["script"]
script_path = os.path.join(SCRIPTS_DIR, script["filename"])
with open(script_path, "w", encoding="utf-8") as f:
Comment thread views/template_view.py
script_path = os.path.join(SCRIPTS_DIR, script["filename"])
with open(script_path, "w", encoding="utf-8") as f:
f.write(script["content"])
os.chmod(script_path, 0o755)
Comment thread app.py
@app.route("/webhooks/jamf/edit")
def _redir_jamf_edit():
name = request.args.get("name", "")
return redirect(f"/automations/jamfpro/{name}/edit", code=301)
Comment thread app.py
@app.route("/webhooks/custom/edit")
def _redir_custom_edit():
name = request.args.get("name", "")
return redirect(f"/automations/custom/{name}/edit", code=301)
Comment thread app.py
@app.route("/cron/edit")
def _redir_cron_edit():
name = request.args.get("name", "")
return redirect(f"/automations/cron/{name}/edit", code=301)
Comment thread app.py
@app.route("/cron/delete")
def _redir_cron_delete():
name = request.args.get("target_job", "")
return redirect(f"/automations/cron/{name}/delete", code=301)
Comment thread app.py

webhook = get_webhook_by_name(name)
tag = webhook.get("tag", "custom") if webhook else "custom"
return redirect(f"/automations/{tag}/{name}/delete", code=301)
Comment thread views/template_view.py

@blueprint.route("/workflows/<path:rest>")
def workflows_rest_redirect(rest: str) -> Response:
return redirect(f"/templates/{rest}", code=301)
@ball42 ball42 changed the base branch from main to develop July 7, 2026 23:30
@ball42 ball42 changed the title Add CI, UI enhancements, and improved error handling feat: add smoke-test harness and CI (ruff + pytest) Jul 7, 2026
@ball42 ball42 marked this pull request as ready for review July 7, 2026 23:54
@ball42 ball42 merged commit 609f975 into develop Jul 7, 2026
3 of 4 checks passed
@ball42 ball42 deleted the test/smoke-harness branch July 8, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants