Merge lp://staging/~newz/awstrial/3rdlevel-domain-blacklisting into lp://staging/awstrial

Proposed by Matthew Nuzum
Status: Merged
Approved by: Matthew Nuzum
Approved revision: 299
Merged at revision: 296
Proposed branch: lp://staging/~newz/awstrial/3rdlevel-domain-blacklisting
Merge into: lp://staging/awstrial
Diff against target: 128 lines (+76/-16)
2 files modified
awstrial/trial/auth.py (+19/-6)
awstrial/trial/tests.py (+57/-10)
To merge this branch: bzr merge lp://staging/~newz/awstrial/3rdlevel-domain-blacklisting
Reviewer Review Type Date Requested Status
Māris Fogels (community) Approve
Matthew Nuzum (community) Needs Resubmitting
Review via email: mp+132717@code.staging.launchpad.net

Commit message

This updates the blacklisted_email_domain function and the tests in order to allow blocking of 3rd level domains if there 2nd level component is blocked. Fixes bug #1074165

Description of the change

This updates the blacklisted_email_domain function and the tests in order to allow blocking of 3rd level domains if there 2nd level component is blocked.

For example:
  Free mail service xyz.com is often used for abusers but email addresses are in the form of
  <email address hidden>

Now, simply blocking xyz.com will also block randombits.xyz.com.

To post a comment you must log in.
298. By Matthew Nuzum

Enabling support for unlimted levels to the domain that can be blocked

Revision history for this message
Māris Fogels (mars) wrote :

The implementation itself looks OK. The tests need some work:

'settings' is a global variable and fiddling with it is bad. It is better to have a single test that asserts that the setting is true and take the check out of the individual tests.

You don't need to check the log message in every test. You need two separate tests just for logging: one that checks that the log message is present for blacklisted addresses, one that tests that it is absent for valid addresses. If you have the two logging tests, then you can remove all the log check lines from the new tests you wrote.

That logger line is old code, but it's terrible. Please change it to the standard logging pattern using logging.getLogger(__name__). There are plenty of examples of the right way in awstrial and in fenchurch.

review: Needs Fixing
299. By Matthew Nuzum

mocking settings

Revision history for this message
Matthew Nuzum (newz) wrote :

I've updated it to use the method decorators for settings, removed the tests for logging and confirmed that it us using logging.getLogger(that part did not change so is not in the diff).

review: Needs Resubmitting
Revision history for this message
Māris Fogels (mars) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches