Skip to content

Improve test coverage for convert.py with edge case scenarios#2878

Merged
sydseter merged 2 commits intoOWASP:masterfrom
theanand108:edge-tests-clean
Apr 25, 2026
Merged

Improve test coverage for convert.py with edge case scenarios#2878
sydseter merged 2 commits intoOWASP:masterfrom
theanand108:edge-tests-clean

Conversation

@theanand108
Copy link
Copy Markdown
Contributor

Summary

This PR improves test coverage for convert.py by adding unit tests targeting previously uncovered edge cases and error-handling paths.

Changes

Added tests for:

  • _parse_mapping_file

    • Exception handling during YAML parsing
  • _validate_file_paths

    • Output directory outside allowed base path
  • _convert_with_docx2pdf

    • Successful conversion scenario
    • Exception during import/conversion
  • _rename_libreoffice_output

    • File renaming behavior when output already exists
  • create_edition_from_template

    • DOCX flow ensuring document is processed and saved correctly
  • main

    • Handling when PDF conversion is requested but not supported

Notes

  • No functional code changes were made
  • Existing tests remain unaffected
  • Focused only on improving coverage and robustness of edge cases

Impact

  • Improves reliability of conversion workflows
  • Increases confidence in error handling paths
  • Helps maintain high overall test coverage

AI Disclosure

Parts of this contribution were developed with the assistance of AI tools (ChatGPT) for guidance on test design and edge case identification. All code has been reviewed, tested, and validated by the author.

Affirmation

  • My code follows the CONTRIBUTING.md guidelines

@sydseter sydseter merged commit dffc466 into OWASP:master Apr 25, 2026
12 checks passed
@theanand108 theanand108 deleted the edge-tests-clean branch April 25, 2026 12:05
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