Skip to content

Conversation

@wneessen
Copy link
Owner

@wneessen wneessen commented Oct 3, 2024

This PR adds more tests to the smtp package, especially the auth parts.

Winni Neessen added 5 commits October 2, 2024 18:02
Centralized error definitions in `smtp/auth.go` and updated references in `auth_login.go` and `auth_plain.go`. This improves code maintainability and error consistency across the package.
Refactor error return to include more specific information and add a check for TLS connection state in SCRAM-SHA-X-PLUS authentication flow. This ensures clearer error messages and verifies essential prerequisites for secure authentication.
Introduced new test cases for SCRAM-SHA-1, SCRAM-SHA-256, and their PLUS variants in `smtp_test.go`. Updated the authTest structure to include a `hasNonce` flag and implemented logic to handle nonce validation and success message processing.
Introduce new unit tests to verify SCRAM-SHA-1 and SCRAM-SHA-256 authentication for the SMTP client. These tests cover both successful and failing authentication cases, and include a mock SMTP server to facilitate testing.
Add checks to handle errors when reading client messages. This ensures that an appropriate error message is sent back to the client if reading fails, improving the robustness of the SMTP authentication process.
@codecov
Copy link

codecov bot commented Oct 3, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 84.51%. Comparing base (a41639e) to head (03062c5).

Files with missing lines Patch % Lines
smtp/auth_scram.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #317      +/-   ##
==========================================
+ Coverage   80.32%   84.51%   +4.18%     
==========================================
  Files          27       27              
  Lines        2348     2350       +2     
==========================================
+ Hits         1886     1986     +100     
+ Misses        346      232     -114     
- Partials      116      132      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wneessen wneessen merged commit ff5454a into main Oct 3, 2024
8 of 12 checks passed
@wneessen wneessen deleted the more-auth-test-coverage branch October 3, 2024 10:41
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