Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

728 mail aliases needs a new test suite #746

Closed
wants to merge 7 commits into from

Conversation

bluairis
Copy link
Contributor

@bluairis bluairis commented Apr 5, 2024

Fixes #728

Changes in this request

  • I added a few tests for the mail aliases page (I did not test each_list because it needs to be fixed pretty soon)
  • I made one change to the filter function because the test made me realize that it was removing aliases like "MAILER-DAEMON" from "m" filter value because it was only looking for lowercase first values
  • Tests are passing.

@bluairis bluairis requested review from bufordrat and bbusenius April 5, 2024 21:06
Copy link
Member

@bbusenius bbusenius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are a good start. I have a couple of suggestions:

  1. It would be nice if the names of the test functions conveyed more information about what you're testing about the functions. The Django convention is to use long descriptive function names in tests, rather than docstrings, however, there's nothing wrong with adding a docstring if this isn't possible or if you want to be more descriptive. Part 5 of the Django tutorial has good information about this.
  2. It would be really good to have a test that covers the case for when the MAIL_ALIASES_PATH file isn't found.

aliaslist.append(alias3)
aliaslist.append(alias4)
aliaslist.append(alias5)
self.assertEqual(filter_by_value(aliaslist, ""), aliaslist)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good to see you testing for the empty string case.

Copy link
Collaborator

@bufordrat bufordrat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, tests pass on my machine. I don't have any suggestions other than that I agree with the suggestion to have the site for the case where there is no file at MAIL_ALIASES_PATH, and then to also write a test confirming that the site doesn't blow up with an internal server error when that file is missing. With-finalizing in parse_file looks good.

@bufordrat
Copy link
Collaborator

These changes were incorporated into the code by way of PR #766. Thank you @bluairis for all your work on this.

@bufordrat
Copy link
Collaborator

bufordrat commented Jun 26, 2024

Closing the PR...

@bufordrat bufordrat closed this Jun 26, 2024
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.

Mail aliases needs new test suite
3 participants