aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py (unfollow)
Commit message (Collapse)AuthorLines
2020-06-21Incidents: append `actioned_by` to webhook usernameGravatar kwzrd-10/+22
Incident author and the moderator who actioned report are now passed through `make_username` to create the webhook username. Tests adjusted as appropriate.
2020-06-21Incidents: implement `make_username` helperGravatar kwzrd-0/+53
The justification is to incorporate the `actioned_by` name into the username in some way, and so the logical thing to do is to abstract this process into a helper so that it can easily be adjusted in the future. For now, I've chosen to separate the names by a pipe. Discord webhook username cannot exceed 80 characters in length, and so we cap it at this length by default. This is seen as more of an edge-case, but it should be accounted for, as we're not joining two names. The `max_length` param is configurable primarily for testing purposes, it probably should never be passed explicitly. This commit also provides two tests for the function.
2020-06-20Incidents tests: assert webhook username is de-clydedGravatar kwzrd-0/+19
See: a8b4e394d9da57287cd9497cd9bb0a97fa467e84
2020-06-20Incidents: de-clyde archive webhook usernameGravatar kwzrd-1/+2
With PR #1009 merged, we now apply the same fix to our relay function. This prevents the "clyde" word from sneaking into the webhook username, which is forbidden and will return a 400.
2020-06-20Incidents tests: remove unnecessary patchGravatar kwzrd-1/+0
This is already being patched at class-level.
2020-06-20Incidents: try-except Signal creationGravatar kwzrd-11/+15
Suggested by Mark during review. This follows the "ask for forgiveness rather than permission" paradigm, ends up being less code to read, and may be seen as more logical / safer. The `ALLOWED_EMOJI` set was renamed to `ALL_SIGNALS` as this now better communicates the set's purpose. Tests adjusted as appropriate. Co-authored-by: MarkKoz <[email protected]>
2020-06-20Incidents: simplify set operation in `has_signals`Gravatar kwzrd-2/+1
Using `issubset` is a much simpler & more readable way of expressing the relationship between the two sets. Suggested by Mark during review. Co-authored-by: MarkKoz <[email protected]>
2020-06-20Incidents: make crawl limit & sleep module-level constantsGravatar kwzrd-10/+13
Requested during review. Co-authored-by: ks129 <[email protected]> Co-authored-by: Joseph Banks <[email protected]>
2020-06-20Incidents: make logs contain the message id they pertain toGravatar kwzrd-4/+4
Suggested by Mark during review. Co-authored-by: MarkKoz <[email protected]>
2020-06-20Incidents: remove redundant `exc_info` passingGravatar kwzrd-4/+4
Pointed out by Mark during review that this is unnecessary, as logging using `exception` automatically appends the `exc_info` of the handled exception when done in an except block. Co-authored-by: MarkKoz <[email protected]>