-
Notifications
You must be signed in to change notification settings - Fork 62
Tool to test osctrl-api
#762
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
Conversation
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.
Pull request overview
This PR replaces the basic api_testing.py script with a more comprehensive API testing tool renamed to api_tester.py. The new tool provides systematic testing of all osctrl-api endpoints with detailed reporting, authentication support, and configurable options.
Key changes:
- Complete rewrite of the API testing script with enhanced functionality
- Added support for token-based authentication and login flow
- Implemented comprehensive test coverage across all API endpoint categories
- Added colored output, verbose mode, and configurable SSL verification
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| tools/api_testing.py | Removed old basic API testing script |
| tools/api_tester.py | Added new comprehensive API testing tool with full endpoint coverage and authentication |
| tools/README.md | Updated documentation to reflect new tool name and usage patterns |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try: | ||
| response_json = response.json() | ||
| self.log_verbose(f" Response: {json.dumps(response_json, indent=2)}") | ||
| except: |
Copilot
AI
Dec 23, 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.
Bare except clause catches all exceptions including system exits and keyboard interrupts. Use 'except Exception:' or specify the expected exception type (e.g., 'json.JSONDecodeError').
| except: | |
| except (ValueError, json.JSONDecodeError): |
| try: | ||
| error_data = response.json() | ||
| self.log(f" Error: {error_data.get('error', 'Unknown error')}", Colors.RED) | ||
| except: |
Copilot
AI
Dec 23, 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.
Bare except clause catches all exceptions including system exits and keyboard interrupts. Use 'except Exception:' or specify the expected exception type (e.g., 'json.JSONDecodeError').
| except: | |
| except ValueError: |
| error_data = response.json() | ||
| error_msg = error_data.get('error', 'Unknown error') | ||
| self.log(f"✗ Login failed: {error_msg}", Colors.RED) | ||
| except: |
Copilot
AI
Dec 23, 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.
Bare except clause catches all exceptions including system exits and keyboard interrupts. Use 'except Exception:' or specify the expected exception type (e.g., 'json.JSONDecodeError').
| error_data = response.json() | ||
| error_msg = error_data.get('error', 'Bad request') | ||
| self.log(f"✗ Login failed: {error_msg}", Colors.RED) | ||
| except: |
Copilot
AI
Dec 23, 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.
Bare except clause catches all exceptions including system exits and keyboard interrupts. Use 'except Exception:' or specify the expected exception type (e.g., 'json.JSONDecodeError').
| error_data = response.json() | ||
| error_msg = error_data.get('error', f'HTTP {response.status_code}') | ||
| self.log(f"✗ Login failed: {error_msg}", Colors.RED) | ||
| except: |
Copilot
AI
Dec 23, 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.
Bare except clause catches all exceptions including system exits and keyboard interrupts. Use 'except Exception:' or specify the expected exception type (e.g., 'json.JSONDecodeError').
Adding new tool to test
osctrl-api:Updated
READMEas well.