aboutsummaryrefslogtreecommitdiffstats
path: root/tests (follow)
Commit message (Collapse)AuthorAgeLines
...
| | | * | | | | | | | | | 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.
| | | * | | | | | | | | | 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
| | | |\ \ \ \ \ \ \ \ \ \
| | | * | | | | | | | | | | Incidents tests: write tests for `process_event`Gravatar kwzrd2020-06-18-1/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also breaks the helpers import statement into a vertical list, as the amount of imports has grown too much. I still believe that this is a preferred alternative to accessing the helpers via module namespace, as we use them a lot, and the added visual noise would be annoying to read - their names are already descriptive enough.
| | | * | | | | | | | | | | Incidents tests: write tests for `make_confirmation_task`Gravatar kwzrd2020-06-13-0/+35
| | | | | | | | | | | | | |
| | | * | | | | | | | | | | Incidents tests: write tests for `on_message`Gravatar kwzrd2020-06-13-0/+27
| | | | | | | | | | | | | |
| | | * | | | | | | | | | | Incidents tests: test non-404 error responseGravatar kwzrd2020-06-13-0/+20
| | | | | | | | | | | | | |
| | | * | | | | | | | | | | Incidents tests: write tests for `resolve_message`Gravatar kwzrd2020-06-13-0/+56
| | | | | | | | | | | | | |
| | | * | | | | | | | | | | Incidents tests: move `mock_404` into module namespaceGravatar kwzrd2020-06-13-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will be useful for others tests as well.
| | | * | | | | | | | | | | Incidents tests: write tests for `archive`Gravatar kwzrd2020-06-13-2/+63
| | | | | | | | | | | | | |
| | | * | | | | | | | | | | Incidents tests: set up base class for `Incidents`Gravatar kwzrd2020-06-13-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For cleanliness, I've decided to make a separate class for each method. Since most tests will want to have an `Incident` instance ready, they can inherit the `setUp` from `TestIncidents`, which does not make any assertions on its own.
| | | * | | | | | | | | | | Incidents tests: improve mock `Signal` name & move defGravatar kwzrd2020-06-13-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let's make it clear that this is our own mock. We also move the definition to the top of the module.
| | | * | | | | | | | | | | Incidents tests: use our own helper mocksGravatar kwzrd2020-06-13-16/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No reason to build own MagicMocks as we already have helpers that more accurately mimic the mocked behaviour.
| | | * | | | | | | | | | | Incidents tests: write tests for module-level helpersGravatar kwzrd2020-06-12-0/+135
| | | | | | | | | | | | | |
| | | * | | | | | | | | | | Incidents tests: create new test moduleGravatar kwzrd2020-06-12-0/+0
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: space out lines for readabilityGravatar MarkKoz2020-07-22-0/+6
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: remove default_args attributeGravatar MarkKoz2020-07-22-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Kind of redundant since it's only used by two tests.
| | * | | | | | | | | | | | Jam Tests: re-arrange tests to follow definition order in the cogGravatar MarkKoz2020-07-22-10/+10
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: fix utils patchGravatar MarkKoz2020-07-22-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | stop needs to be called on the patcher, not the mock. Furthermore, using addCleanup is safer than tearDown because the latter may not be called if an exception is raised in setUp.
| | * | | | | | | | | | | | Jam Tests: Fix `test_duplicate_member_provided` assertionsGravatar ks1292020-06-13-1/+3
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: Fix wrong function name and convert them to mocksGravatar ks1292020-06-13-1/+3
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: Simplify and make tests more secureGravatar ks1292020-06-13-6/+4
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: Update `Context` to `Guild` for tests tooGravatar ks1292020-06-13-19/+19
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: Apply recent command splitting to `test_jam_roles_adding`Gravatar ks1292020-06-11-2/+2
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: Remove unnecessary `Context` mock resetsGravatar ks1292020-06-11-2/+0
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: Implement default argumentsGravatar ks1292020-06-11-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To avoid repeating same arguments, added default arguments that is unpacked on function call.
| | * | | | | | | | | | | | Jam Tests: Apply recent changes to `test_category_dont_exist`Gravatar ks1292020-06-11-2/+1
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: Simplify and update `test_category_channel_exist`Gravatar ks1292020-06-11-3/+1
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: Merge text and voice channel creation testsGravatar ks1292020-06-11-21/+24
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: Apply recent changes to overwrites testGravatar ks1292020-06-11-2/+1
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: Add more assertions to result message sending testGravatar ks1292020-06-11-1/+7
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: Make early exiting test more secureGravatar ks1292020-06-11-2/+6
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: Use class member of patch instead decorator on most of testsGravatar ks1292020-06-11-21/+19
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: Fix `test_result_sending` docstringGravatar ks1292020-06-11-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Mark <[email protected]>
| | * | | | | | | | | | | | Jam Tests: Create test for `setup` functionGravatar ks1292020-06-11-1/+11
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: Create test for successful `ctx.send` callingGravatar ks1292020-06-11-0/+6
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: Create test for team jam roles addingGravatar ks1292020-06-11-0/+14
| | | | | | | | | | | | | |
| | * | | | | | | | | | | | Jam Tests: Create test for team voice channel creatingGravatar ks1292020-06-11-0/+12
| | | | | | | | | | | | | |