feat(python): add unit tests and remove hardcoded credentials#49
Open
57388sp wants to merge 2 commits into
Open
feat(python): add unit tests and remove hardcoded credentials#4957388sp wants to merge 2 commits into
57388sp wants to merge 2 commits into
Conversation
- Clear all hardcoded IPs, passwords, SVM/volume/aggregate names from INPUTS/ENV blocks in all 9 Python scripts; values must now be supplied via environment variables or the INPUTS dict at runtime - Add Unit_tests/ suite: 142 tests covering all 9 scripts + OntapClient - Add pytest.ini and requirements-dev.txt for test tooling - Refactor ontap_client: _DEFAULT_TIMEOUT=90, poll_job, wait_snapmirrored, load_env_file, update_auth, __all__ - Reduce cyclomatic complexity across all scripts (all functions A/B grade) - Fix non-ASCII characters in comments (U+2026, U+2192 replaced) - Add type hints and docstrings to all public functions - ruff: 0 warnings; pytest: 142 passed
|
Test Report Environment: N/A - this PR does not add or modify a runnable example. The changes in this PR are:
Unit test run (first run): python -m pytest Unit_tests/ -q |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a comprehensive unit test suite for all Python scripts and remove all
hardcoded credentials and environment-specific values.
Changes
Unit tests (new)
Unit_tests- 142 tests covering all 9 scripts +OntapClientpytest.ini- test configurationrequirements-dev.txt- dev/test dependenciesPython scripts
INPUTS/ENVblocks: IP addresses, passwords, SVM names,volume names, aggregate names - all must now be supplied via environment variables
ontap_client.py:_DEFAULT_TIMEOUT=90, addedpoll_job(),wait_snapmirrored(),load_env_file(),update_auth(),__all__Quality gates
ruff check python/ Unit_tests/- 0 warningspytest Unit_tests/ -q- 142 passedSecurity
os.environor theINPUTS/ENVdict at runtime