Commit Graph

9 Commits

Author SHA1 Message Date
Claude
cbbf801d7c Add comprehensive tests for Assets API (14 tests)
Tests include:
- Asset model validation (8 tests)
  - Asset, AssetRename, FolderCreate models
  - Field validation, filename validation
  - Size helper methods (size_mb, size_kb)
  - Slug normalization

- Sync AssetsEndpoint (6 tests)
  - List, get, rename, delete operations
  - Folder listing
  - Validation error handling

All 14 tests passing. Achieves comprehensive coverage for Assets API.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-22 20:36:01 +00:00
Claude
5c0de7f70b Add comprehensive tests for Groups API (24 tests)
Tests include:
- Group model validation (8 tests)
  - Group, GroupCreate, GroupUpdate models
  - Field validation, name validation
  - Minimal and full field tests

- Sync GroupsEndpoint (8 tests)
  - List, get, create, update, delete operations
  - User assignment/unassignment operations
  - Validation error handling

- Async AsyncGroupsEndpoint (8 tests)
  - Complete async coverage matching sync API
  - All CRUD operations tested
  - User management operations

All 24 tests passing. Achieves comprehensive coverage for Groups API.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-22 20:29:11 +00:00
Claude
2ea3936b5c Add comprehensive tests for Users API (70 tests total)
Tests include:
- User model validation (22 tests)
  - UserGroup, User, UserCreate, UserUpdate models
  - Field validation, email validation, password strength
  - CamelCase alias support

- Sync UsersEndpoint (24 tests)
  - List, get, create, update, delete operations
  - Search functionality
  - Pagination and filtering
  - Error handling and validation
  - Data normalization

- Async AsyncUsersEndpoint (24 tests)
  - Complete async coverage matching sync API
  - All CRUD operations tested
  - Validation and error handling

All 70 tests passing. Achieves >95% coverage for Users API code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-22 20:18:27 +00:00
Claude
0fa290d67b Add comprehensive async tests - all 37 tests passing
Phase 2, Task 2.1, Step 4 Complete: Async Testing Suite

This commit adds a complete test suite for the async client and
async pages endpoint, achieving 100% pass rate for async functionality.

Test Coverage:
--------------

1. **AsyncWikiJSClient Tests** (test_async_client.py)
   - Initialization tests (5 tests)
     * API key string initialization
     * Auth handler initialization
     * Invalid auth parameter handling
     * Custom settings configuration
     * Pages endpoint availability

   - HTTP Request tests (5 tests)
     * Successful API requests
     * 401 authentication errors
     * API error handling (500 errors)
     * Connection error handling
     * Timeout error handling

   - Connection Testing (4 tests)
     * Successful connection test
     * GraphQL error handling
     * Invalid response format detection
     * Missing configuration detection

   - Context Manager tests (2 tests)
     * Async context manager protocol
     * Manual close handling

   - Session Creation tests (3 tests)
     * Session creation and configuration
     * Lazy session initialization
     * Session reuse

2. **AsyncPagesEndpoint Tests** (test_async_pages.py)
   - Initialization test
   - List operations (3 tests)
     * Basic listing
     * Parameterized filtering
     * Validation errors

   - Get operations (3 tests)
     * Get by ID
     * Validation errors
     * Not found handling

   - Get by path operation
   - Create operations (2 tests)
     * Successful creation
     * Failed creation handling

   - Update operation
   - Delete operations (2 tests)
     * Successful deletion
     * Failed deletion handling

   - Search operation
   - Get by tags operation
   - GraphQL error handling
   - Data normalization tests (2 tests)

Bug Fixes:
----------
- Fixed exception handling order in AsyncWikiJSClient._request()
  * ServerTimeoutError now caught before ClientConnectionError
  * Prevents timeout errors being misclassified as connection errors

- Fixed test mocking for async context managers
  * Properly mock __aenter__ and __aexit__ methods
  * Fixed session creation in async context

Test Results:
-------------
 37/37 tests passing (100% pass rate)
 Async client tests: 19/19 passing
 Async pages tests: 18/18 passing
 53% overall code coverage (includes async code)
 Zero flake8 errors
 All imports successful

Quality Metrics:
----------------
- Test coverage for async module: >85%
- All edge cases covered (errors, validation, not found)
- Proper async/await usage throughout
- Mock objects properly configured
- Clean test structure and organization

Next Steps:
-----------
- Create async usage examples
- Write async documentation
- Performance benchmarks (async vs sync)
- Integration tests with real Wiki.js instance

This establishes a solid foundation for async development
with comprehensive test coverage ensuring reliability.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-22 18:12:29 +00:00
Claude
66f4471e53 Fix 3 critical issues identified in repository review
**Critical Fixes:**

1. **Fixed Error Hierarchy** (wikijs/exceptions.py)
   - ConnectionError and TimeoutError now properly inherit from APIError
   - Ensures consistent exception handling across the SDK
   - Added proper __init__ methods with status_code=None

2. **Fixed test_connection Method** (wikijs/client.py)
   - Changed from basic HTTP GET to proper GraphQL query validation
   - Now uses query { site { title } } to validate API connectivity
   - Provides better error messages for authentication failures
   - Validates both connectivity AND API access

3. **Implemented JWT Token Refresh** (wikijs/auth/jwt.py)
   - Added base_url parameter to JWTAuth class
   - Implemented complete refresh() method with HTTP request to /api/auth/refresh
   - Handles token, refresh token, and expiration updates
   - Proper error handling for network failures and auth errors

**Bonus Fixes:**
- Dynamic user agent version (uses __version__ from version.py instead of hardcoded)
- Updated all JWT tests to include required base_url parameter
- Updated test mocks to match new GraphQL-based test_connection

**Test Results:**
- All 231 tests passing 
- Test coverage: 91.64% (target: 85%) 
- No test failures or errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-22 17:44:44 +00:00
19362ddeb3 testing adjustments 2025-07-30 21:34:55 -04:00
ade9aacf56 Fix code formatting and linting issues
- Updated GitHub Actions workflow to use correct flake8 configuration
- Fixed line length issues by using 88 characters as configured
- Removed unused imports and trailing whitespace
- Fixed f-string placeholders and unused variables
- All linting checks now pass with project configuration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-30 20:49:40 -04:00
db95a4c1be changed to github deployment for the first version. 2025-07-30 19:43:23 -04:00
18a82711cb ready for try 2025-07-29 20:16:11 -04:00