-
Notifications
You must be signed in to change notification settings - Fork 0
test: add comprehensive E2E test suite for CLI wrapper #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3c11553
7f19197
fc86f5b
a73fe18
f57f31d
a2b6b27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,47 @@ | ||||||||||||||||||||||||||||||||||||||||
| name: E2E Tests | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||||||||||
| branches: [main, develop] | ||||||||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||||||||
| branches: [main, develop] | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||
| e2e-tests: | ||||||||||||||||||||||||||||||||||||||||
| name: E2E Tests (Python ${{ matrix.python-version }}) | ||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| strategy: | ||||||||||||||||||||||||||||||||||||||||
| fail-fast: false | ||||||||||||||||||||||||||||||||||||||||
| matrix: | ||||||||||||||||||||||||||||||||||||||||
| python-version: ["3.10", "3.11", "3.12"] | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - name: Set up Python ${{ matrix.python-version }} | ||||||||||||||||||||||||||||||||||||||||
| uses: actions/setup-python@v5 | ||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||
| python-version: ${{ matrix.python-version }} | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - name: Install dependencies | ||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||
| python -m pip install --upgrade pip | ||||||||||||||||||||||||||||||||||||||||
| pip install -e ".[dev,test]" | ||||||||||||||||||||||||||||||||||||||||
| - name: Run unit tests | ||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||
| pytest tests/unit/ -v --cov=capiscio --cov-report=xml --cov-report=term | ||||||||||||||||||||||||||||||||||||||||
| - name: Run E2E tests | ||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||
| pytest tests/e2e/ -v --tb=short | ||||||||||||||||||||||||||||||||||||||||
| - name: Upload coverage reports | ||||||||||||||||||||||||||||||||||||||||
| if: matrix.python-version == '3.11' | ||||||||||||||||||||||||||||||||||||||||
| uses: codecov/codecov-action@v4 | ||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||
| file: ./coverage.xml | ||||||||||||||||||||||||||||||||||||||||
| flags: unittests | ||||||||||||||||||||||||||||||||||||||||
| name: codecov-umbrella | ||||||||||||||||||||||||||||||||||||||||
| fail_ci_if_error: false | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+32
to
+47
|
||||||||||||||||||||||||||||||||||||||||
| - name: Run unit tests | |
| run: | | |
| pytest tests/unit/ -v --cov=capiscio --cov-report=xml --cov-report=term | |
| - name: Run E2E tests | |
| run: | | |
| pytest tests/e2e/ -v --tb=short | |
| - name: Upload coverage reports | |
| if: matrix.python-version == '3.11' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| - name: Run E2E tests | |
| run: | | |
| pytest tests/e2e/ -v --tb=short |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: Unit Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, develop] | ||
| pull_request: | ||
| branches: [main, develop] | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Unit Tests (Python ${{ matrix.python-version }}) | ||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
| python-version: ["3.10", "3.11", "3.12"] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -e ".[dev,test]" | ||
|
|
||
| - name: Run unit tests | ||
| run: | | ||
| pytest tests/unit/ -v --cov=capiscio --cov-report=xml --cov-report=term | ||
|
|
||
| - name: Upload coverage | ||
| if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' | ||
| uses: codecov/codecov-action@v4 | ||
| with: | ||
| file: ./coverage.xml | ||
| flags: unittests | ||
| name: codecov-umbrella |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| [pytest] | ||
| testpaths = tests | ||
| python_files = test_*.py | ||
| python_classes = Test* | ||
| python_functions = test_* | ||
| addopts = -v --strict-markers | ||
| markers = | ||
| e2e: marks tests as end-to-end tests requiring a live server | ||
| unit: marks tests as unit tests (no external dependencies) | ||
|
|
||
| filterwarnings = | ||
| ignore::DeprecationWarning |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,98 @@ | ||||||
| # Tests for capiscio-python CLI | ||||||
|
|
||||||
| This directory contains unit and E2E tests for the `capiscio` CLI wrapper. | ||||||
|
|
||||||
| ## Directory Structure | ||||||
|
|
||||||
| ``` | ||||||
| tests/ | ||||||
| ├── unit/ # Unit tests with mocks (no server required) | ||||||
| │ ├── test_cli.py | ||||||
| │ └── test_manager.py | ||||||
| └── e2e/ # E2E tests (offline mode, no server required) | ||||||
| ├── conftest.py # Pytest fixtures and configuration | ||||||
| ├── fixtures/ # Test data files | ||||||
| │ ├── valid-agent-card.json | ||||||
| │ ├── invalid-agent-card.json | ||||||
| │ └── malformed.txt | ||||||
| ├── test_validate_e2e.py # Validation command tests | ||||||
| └── test_badge_e2e.py # Badge issuance/verification tests | ||||||
| ``` | ||||||
|
|
||||||
| ## Running Tests | ||||||
|
|
||||||
| ### Run All Tests | ||||||
|
|
||||||
| ```bash | ||||||
| pytest # All tests | ||||||
| pytest tests/unit/ # Unit tests only | ||||||
| pytest tests/e2e/ # E2E tests only | ||||||
| ``` | ||||||
|
|
||||||
| ### Run Specific Test File | ||||||
|
|
||||||
| ```bash | ||||||
| pytest tests/e2scio --cov-report=html | ||||||
|
||||||
| pytest tests/e2scio --cov-report=html | |
| pytest tests/e2e/ --cov-report=html |
Copilot
AI
Dec 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 58 contains a broken line that appears to be incorrectly formatted: "### ├── test_validate_e2e.sue self-signed badge". This appears to be a copy-paste error or incomplete edit. The section header is malformed and the content doesn't make sense ("sue self-signed badge"). This should likely be removed or replaced with proper documentation about the Badge Command test coverage.
| ### ├── test_validate_e2e.sue self-signed badge | |
| ### Badge Command (`test_badge_e2e.py`) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| """ | ||
| pytest configuration for capiscio-python CLI E2E tests. | ||
|
|
||
| Provides fixtures for testing the CLI offline using: | ||
| - validate --schema-only | ||
| - badge issue --self-sign | ||
| - badge verify --accept-self-signed --offline | ||
| """ | ||
|
|
||
| import pytest | ||
| from pathlib import Path | ||
|
|
||
|
|
||
| @pytest.fixture(scope="session") | ||
| def fixtures_dir() -> Path: | ||
| """Get path to fixtures directory.""" | ||
| return Path(__file__).parent / "fixtures" | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def valid_agent_card_path(fixtures_dir: Path) -> Path: | ||
| """Path to valid agent card fixture.""" | ||
| return fixtures_dir / "valid-agent-card.json" | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def invalid_agent_card_path(fixtures_dir: Path) -> Path: | ||
| """Path to invalid agent card fixture.""" | ||
| return fixtures_dir / "invalid-agent-card.json" | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def malformed_json_path(fixtures_dir: Path) -> Path: | ||
| """Path to malformed JSON fixture.""" | ||
| return fixtures_dir / "malformed.txt" | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def nonexistent_path(fixtures_dir: Path) -> Path: | ||
| """Path to a file that doesn't exist.""" | ||
| return fixtures_dir / "does-not-exist.json" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "version": "1.0", | ||
| "did": "invalid-did-format", | ||
| "name": "Invalid Agent", | ||
| "publicKey": { | ||
| "kty": "WRONG", | ||
| "x": "invalid-key-data" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "version": "1.0", | ||
| "did": "did:web:example.com" | ||
| "missing": "comma above" | ||
beonde marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "protocolVersion": "1.3.0", | ||
| "version": "1.0.0", | ||
| "name": "Test Agent", | ||
| "description": "A test agent for E2E validation tests", | ||
| "url": "https://example.com/.well-known/agent.json", | ||
| "capabilities": { | ||
| "streaming": false, | ||
| "pushNotifications": false | ||
| }, | ||
| "skills": [ | ||
| { | ||
| "id": "test-skill", | ||
| "name": "Test Skill", | ||
| "description": "A skill for testing", | ||
| "tags": ["test", "validation"] | ||
| } | ||
| ], | ||
| "provider": { | ||
| "organization": "Test Organization", | ||
| "url": "https://example.com" | ||
| }, | ||
| "authentication": { | ||
| "schemes": ["none"] | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.