Skip to content

Comments

test: add unit tests for Postfix log parser (issue #18)#27

Merged
monozoide merged 1 commit intomonozoide:mainfrom
Ujjwal-Bajpayee:main
Oct 5, 2025
Merged

test: add unit tests for Postfix log parser (issue #18)#27
monozoide merged 1 commit intomonozoide:mainfrom
Ujjwal-Bajpayee:main

Conversation

@Ujjwal-Bajpayee
Copy link
Contributor

Purpose of this PR

  • Bug fix
  • New feature
  • Documentation
  • Refactoring / Code quality (tests added)

Description

This PR adds comprehensive unit tests for the Postfix log parser, addressing issue #18.

  • New file tests/test_parser.py created (114 lines)
  • Six pytest-based test cases added:
    • Happy path (valid SASL authentication log line)
    • SASL authentication failure
    • Malformed/garbled log line (graceful handling)
    • Missing SASL username
    • Invalid date formats
    • Reverse DNS lookup failure
  • Used mocks for logger, reverse DNS, and IP info manager to isolate the parser
  • All tests pass successfully

How to test?

  1. Run local test suite with:
    pytest
  2. Verify that all 6 new tests in tests/test_parser.py pass.

Checklist

@monozoide monozoide self-requested a review October 2, 2025 20:57
@monozoide monozoide added enhancement New feature or request good first issue Good for newcomers Hacktoberfest Hacktoberfest 2025 labels Oct 2, 2025
@monozoide monozoide moved this to In review in Hacktoberfest 2025 Oct 2, 2025
@monozoide monozoide moved this from In review to Done in Hacktoberfest 2025 Oct 5, 2025
@monozoide monozoide moved this from Done to In review in Hacktoberfest 2025 Oct 5, 2025
@monozoide monozoide merged commit 92c5c1a into monozoide:main Oct 5, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In review to Done in Hacktoberfest 2025 Oct 5, 2025
@monozoide
Copy link
Owner

@Ujjwal-Bajpayee PR accepted, thx 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request good first issue Good for newcomers Hacktoberfest Hacktoberfest 2025

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[TESTS] - Postfix log parser: happy path + SASL + unexpected format

2 participants