ministryofjustice / operations-engineering

This repository is home to the Operations Engineering's tools and utilities for managing, monitoring, and optimising software development processes at the Ministry of Justice. • This repository is defined and managed in Terraform
https://user-guide.operations-engineering.service.justice.gov.uk/
MIT License
15 stars 5 forks source link

🧪 Unit Test Creation for MTA-STS #4521

Closed jasonBirchall closed 4 months ago

jasonBirchall commented 5 months ago

User Need

As a software engineer working in the Operations Engineering team, I want to have comprehensive unit tests for the "check_mta_sts.py" file in the repository /ministryofjustice/bin/check_mta_sts.py, so that we can ensure the script's functionality remains intact and maintainable

Value

Adding comprehensive unit tests to the bin/check_mta_sts.py script will provide confidence in its correctness and help catch any regressions introduced by future modifications. This will contribute to maintaining a reliable email security service by ensuring the integrity of the MTA-STS (SMTP MTA Strict Transport Security) configuration checks for the specified domains.

Functional Requirements:

  1. Wrap the contents of the "check_mta_sts.py" script in a function to facilitate unit testing.
  2. Create a new test file to house the unit tests for the "check_mta_sts.py" script.
  3. Write unit tests to cover the core functionality of the script.
  4. Ensure that the unit tests cover edge cases and potential failure scenarios.

Non-Functional Requirements:

  1. The unit tests should be maintainable, readable, and follow best practices and coding standards.
  2. The test suite should have high coverage and be easily extendable.
  3. The addition of unit tests should not negatively impact the performance of the script.

Acceptance Criteria:

  1. The "check_mta_sts.py" script is wrapped in a function to enable unit testing.
  2. A new test file is created to contain the unit tests for the "check_mta_sts.py" script.
  3. Unit tests are written to cover the core functionality of the script, including domain checks, error handling, and edge cases.
  4. The unit tests pass successfully, verifying the correctness of the script's behaviour.
  5. The changes are reviewed by a member of the Operations Engineering team to ensure code quality and adherence to team standards.

Notes:

vijaykannan21 commented 4 months ago

https://github.com/ministryofjustice/operations-engineering/pull/4571