aboutsummaryrefslogtreecommitdiffstats
path: root/tests (follow)
Commit message (Collapse)AuthorAgeLines
* Merge 'master' into 'kwzrd/incidents'; resolve mod pkg init conflictGravatar kwzrd2020-07-08-24/+242
|\
| * Fix imports in slowmode testsGravatar Den42002020-07-06-3/+3
| |
| * Improve set_slowmode tests by checking whether the channel was editedGravatar Den42002020-07-06-8/+22
| |
| * Add multiple test cases for set_slowmode testsGravatar Den42002020-07-06-10/+34
| |
| * Use local text_channel instead of instance attributeGravatar Den42002020-07-06-13/+10
| |
| * Add tests for set_slowmodeGravatar Den42002020-07-06-0/+20
| |
| * Add tests for reset_slowmodeGravatar Den42002020-07-06-3/+22
| |
| * Add tests for cog_check and get_slowmodeGravatar Den42002020-07-06-0/+37
| |
| * Merge branch 'master' into issue926-paginate-long-linesGravatar Kyle Stanley2020-06-26-191/+514
| |\
| | * Merge branch 'master' into bug/backend/bot-50/sync-ignore-guildsGravatar kwzrd2020-06-22-10/+85
| | |\
| | | * Merge branch 'master' into logging-testsGravatar Kieran Siek2020-06-22-200/+1047
| | | |\
| | | * | Logging Tests: Simplify `DEBUG_MODE` `False` testGravatar ks1292020-05-22-11/+1
| | | | | | | | | | | | | | | | | | | | - Remove embed attributes checks - Replace `self.dev_log.assert_awaited_once_with` with `self.dev_log.assert_awaited_once`.
| | | * | Merge branch 'master' into logging-testsGravatar ks1292020-05-17-10/+178
| | | |\ \
| | | * | | Created tests for `bot.cogs.logging` connected message.Gravatar ks1292020-04-14-0/+42
| | | | | |
| | * | | | Sync: fix guild ID checkGravatar MarkKoz2020-06-17-16/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Need to compare the IDs against each other rather than the Guild object against the ID.
| | * | | | Sync: ignore 404s in on_user_updateGravatar MarkKoz2020-06-14-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | 404s probably mean the user is from another guild.
| | * | | | Sync tests: test listeners ignore events from other guildsGravatar MarkKoz2020-06-14-10/+54
| | | | | |
| * | | | | In LinePaginator, truncate words that exceed scale_to_sizeGravatar Kyle Stanley2020-06-26-7/+5
| | | | | |
| * | | | | Update LinePaginator.add_line() testsGravatar Kyle Stanley2020-06-26-5/+5
| | | | | |
| * | | | | Merge branch 'master' into issue926-paginate-long-linesGravatar Kyle Stanley2020-06-04-40/+645
| |\ \ \ \ \
| * | | | | | Improve LinePaginator to support long linesGravatar Kyle Stanley2020-06-04-7/+34
| | | | | | |
* | | | | | | Incidents: archive incident attachmentsGravatar kwzrd2020-07-03-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no handling of file types as explained in the `archive` docstring. Testing indicates that relaying incidents with e.g. a text file attachment is simply a noop in the Discord GUI. If there is at least one attachment, we always only relay the one at index 0, as it is believed the user-sent messages can only contain one attachment at maximum. This also adds an extra test asserting the behaviour when an incident with an attachment is archived. The existing test for `archive` is adjusted to assume no attachments. Joe helped me conceive & test this. Co-authored-by: Joseph Banks <[email protected]>
* | | | | | | Incidents: relay incidents as embeds rather than raw contentGravatar kwzrd2020-07-01-21/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This applies the previously defined `make_embed` function. As the `archive` function is now simpler, I decided to reduce the amount of whitespace ~ it's a lot more compact now. Tests are adjusted as appropriate.
* | | | | | | Incidents: implement `make_embed` helper & testsGravatar kwzrd2020-07-01-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See `make_embed` docstring for further information. The tests are fairly loose and should be easily adjustable in the future should changes be made.
* | | | | | | Incidents: pass `actioned_by` to `archive`Gravatar kwzrd2020-06-30-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an important piece of information that shall be relayed.
* | | | | | | Incidents: revert latest 2 commitsGravatar kwzrd2020-06-30-46/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Decision was made to use embeds to archive incidents instead of webhooking the raw message. As such, we're reverting the branch to a state from which the adjustments will be easier to make. Reverted commits: * a8d179d9b04f54b20c5e870bcfa85c78c42c8dca * 6fa8caed037b247a7c194f58a4635de7dae21fd2
* | | | | | | Incidents: append `actioned_by` to webhook usernameGravatar kwzrd2020-06-21-6/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Incident author and the moderator who actioned report are now passed through `make_username` to create the webhook username. Tests adjusted as appropriate.
* | | | | | | Incidents: implement `make_username` helperGravatar kwzrd2020-06-21-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | | Incidents tests: assert webhook username is de-clydedGravatar kwzrd2020-06-20-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | See: a8b4e394d9da57287cd9497cd9bb0a97fa467e84
* | | | | | | Merge branch 'origin/master' into kwzrd/incidentsGravatar kwzrd2020-06-20-9/+50
|\ \ \ \ \ \ \ | | |_|_|_|_|/ | |/| | | | | | | | | | | | Adds the `sub_clyde` function, which we'll apply to our webhook.
| * | | | | | Merge branch 'master' into bug/mod/bot-2a/webhook-clydeGravatar kwzrd2020-06-20-10/+26
| |\ \ \ \ \ \
| | * \ \ \ \ \ Merge branch 'master' into bug/filters/bot-58/removers-ignore-dmsGravatar Dennis Pham2020-06-19-1/+3
| | |\ \ \ \ \ \
| | * | | | | | | Token remover: exit early if message already deletedGravatar MarkKoz2020-06-15-1/+14
| | | | | | | | |
| | * | | | | | | Token remover: move bot check to on_messageGravatar MarkKoz2020-06-15-16/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It just makes more sense to me to filter out messages at an earlier stage.
| | * | | | | | | Token remover: ignore DMsGravatar MarkKoz2020-06-15-0/+10
| | | |_|_|/ / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's a private channel so there's no risk of a token "leaking". Furthermore, messages cannot be deleted in DMs.
| * / | | | | | Write unit test for `sub_clyde`Gravatar kwzrd2020-06-20-0/+27
| |/ / / / / /
* | | | | | | Incidents tests: remove unnecessary patchGravatar kwzrd2020-06-20-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is already being patched at class-level.
* | | | | | | Incidents: try-except Signal creationGravatar kwzrd2020-06-20-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]>
* | | | | | | Incidents tests: write tests for `on_raw_reaction_add`Gravatar kwzrd2020-06-19-0/+128
| | | | | | |
* | | | | | | Incidents tests: write tests for `crawl_incidents`Gravatar kwzrd2020-06-19-0/+58
| | | | | | |
* | | | | | | Incidents tests: add helper for mocking async for-loopsGravatar kwzrd2020-06-19-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See the docstring. This does not make the ambition to be powerful enough to be included in `tests.helpers`, and is only intended for local purposes.
* | | | | | | Merge branch 'origin/master' into kwzrd/incidentsGravatar kwzrd2020-06-19-107/+302
|\ \ \ \ \ \ \ | | |/ / / / / | |/| | | | |
| * | | | | | Merge branch 'master' into help_channel_rediscacheGravatar Kieran Siek2020-06-16-167/+361
| |\| | | | |
| | * | | | | Merge pull request #937 from python-discord/bug/filters/928/non-ascii-tokenGravatar Mark2020-06-12-102/+285
| | |\ \ \ \ \ | | | | | | | | | | | | | | | | Make token detection more robust and completely rewrite its tests
| | | * \ \ \ \ Merge remote-tracking branch 'origin/master' into ↵Gravatar MarkKoz2020-06-02-40/+645
| | | |\ \ \ \ \ | | | | | |/ / / | | | | |/| | | | | | | | | | | bug/filters/928/non-ascii-token
| | | * | | | | Token remover: remove the `delete_message` functionGravatar MarkKoz2020-06-02-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's redundant; there's no benefit here in abstracting two lines of code into a function.
| | | * | | | | Test find_token_in_message returns None for invalid matchesGravatar MarkKoz2020-05-28-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This covers the case when a token is matched, but its user ID and timestamp turn out to be invalid.
| | | * | | | | Adjust find_token_in_message tests for the recent cog changesGravatar MarkKoz2020-05-28-19/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It now supports the changes that switched to finditer, added match groups, and added the Token NamedTuple. It also accounts for the is_maybe_token function being removed. For the sake of simplicity, call assertions on is_valid_user_id and is_valid_timestamp were not made.
| | | * | | | | Remove is_maybe_token testsGravatar MarkKoz2020-05-28-33/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function was removed due to redundancy. Therefore, its tests are obsolete.
| | | * | | | | Add more thorough and realistic inputs for token ID and timestamp testsGravatar MarkKoz2020-05-27-18/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tests for valid inputs and invalid inputs were split to make them more readable.