aboutsummaryrefslogtreecommitdiffstats
path: root/tests (follow)
Commit message (Collapse)AuthorAgeLines
...
| * | | | | | | | Silence: rename cachesGravatar MarkKoz2020-08-18-20/+20
| | | | | | | | |
| * | | | | | | | Silence tests: remove unnecessary spec_set argsGravatar MarkKoz2020-08-18-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's not really necessary to set to True when mocking functions.
| * | | | | | | | Silence tests: more accurately assert the silence cmd schedule a taskGravatar MarkKoz2020-08-18-3/+7
| | | | | | | | |
| * | | | | | | | Silence tests: add a test for rescheduling active silencesGravatar MarkKoz2020-08-18-0/+29
| | | | | | | | |
| * | | | | | | | Silence tests: test the rescheduler unsilences expired silencesGravatar MarkKoz2020-08-18-0/+14
| | | | | | | | |
| * | | | | | | | Silence tests: test the rescheduler adds permanent silence to notifierGravatar MarkKoz2020-08-18-0/+14
| | | | | | | | |
| * | | | | | | | Silence tests: test the scheduler skips missing channelsGravatar MarkKoz2020-08-18-0/+25
| | | | | | | | |
| * | | | | | | | Silence tests: add a test for _init_cog rescheduling unsilencesGravatar MarkKoz2020-08-18-0/+7
| | | | | | | | |
| * | | | | | | | Silence tests: remove _reschedule patch for cog testsGravatar MarkKoz2020-08-18-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They don't do anything because they patch the class rather than the instance. It's too late for patching the instance to work since the `setUp` fixture, which instantiates the cog, executes before the patches do. Patching `setUp` would work (and its done in the other test cases), but some tests in this case will need the unpatched function too. Patching it doesn't serve much benefit to most tests anyway, so it's not worth the effort trying to make them work where they aren't needed.
| * | | | | | | | Silence tests: access everything via the silence moduleGravatar MarkKoz2020-08-18-24/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The module is imported anyway to keep imports short and clean. Using it in patch targets is shorter and allows for the two imports from the module to be removed.
| * | | | | | | | Silence tests: add a subtest for the manual unsilence messageGravatar MarkKoz2020-08-17-4/+7
| | | | | | | | |
| * | | | | | | | Silence tests: assert against message constantsGravatar MarkKoz2020-08-17-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Duplicating strings in assertions is redundant, closely coupled, and less maintainable.
| * | | | | | | | Silence tests: also test that cache misses preserve other overwritesGravatar MarkKoz2020-08-17-12/+16
| | | | | | | | |
| * | | | | | | | Silence tests: add a test for a mod alert on cache missGravatar MarkKoz2020-08-17-0/+7
| | | | | | | | |
| * | | | | | | | Silence tests: add a test for default overwrites on cache missGravatar MarkKoz2020-08-17-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a False for `add_reactions` in the mock overwrite rather than None to be sure the default (also None) is actually set for it. Fix channels set by `_init_cog` not being mocked properly.
| * | | | | | | | Silence tests: add a test for task cancellationGravatar MarkKoz2020-08-17-0/+5
| | | | | | | | |
| * | | | | | | | Silence tests: add a test for deletion from the time cacheGravatar MarkKoz2020-08-17-0/+5
| | | | | | | | |
| * | | | | | | | Silence tests: add tests for scheduling tasksGravatar MarkKoz2020-08-17-0/+12
| | | | | | | | |
| * | | | | | | | Silence tests: add a test for caching permanent timesGravatar MarkKoz2020-08-17-0/+6
| | | | | | | | |
| * | | | | | | | Silence tests: add a test for the time cacheGravatar MarkKoz2020-08-17-0/+15
| | | | | | | | |
| * | | | | | | | Silence tests: fix mock for _init_taskGravatar MarkKoz2020-08-17-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An `AsyncMock` fails because it returns a coroutine which may only be awaited once. However, an `asyncio.Future` is perfect because it is easy to create and can be awaited repeatedly, just like the actual `asyncio.Task` that is being mocked.
| * | | | | | | | Silence tests: create channel and overwrite in setUp for silence testsGravatar MarkKoz2020-08-17-29/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduce code redundancy by only defining them once.
| * | | | | | | | Silence tests: merge unsilence fixture into setUpGravatar MarkKoz2020-08-17-32/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that there are separate test cases, there's no need to keep the fixtures separate.
| * | | | | | | | Silence tests: autospec _reschedule and SilenceNotifier for cog testsGravatar MarkKoz2020-08-17-4/+10
| | | | | | | | |
| * | | | | | | | Silence tests: separate test cases; refactor names & docstringsGravatar MarkKoz2020-08-17-71/+95
| | | | | | | | |
| * | | | | | | | Silence tests: fix tests for _unsilenceGravatar MarkKoz2020-08-17-30/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a fixture to set up mocks for a successful `unsilence` call. This reduces code redundancy.
| * | | | | | | | Silence tests: fix test_unsilence_private_removed_notifierGravatar MarkKoz2020-08-17-2/+5
| | | | | | | | |
| * | | | | | | | Silence tests: fix overwrite preservation test for silencesGravatar MarkKoz2020-08-17-11/+15
| | | | | | | | |
| * | | | | | | | Silence tests: fix command message testsGravatar MarkKoz2020-08-17-15/+10
| | | | | | | | |
| * | | | | | | | Silence tests: fix test_silence_private_for_falseGravatar MarkKoz2020-08-17-4/+13
| | | | | | | | |
| * | | | | | | | Silence tests: fix test_silence_private_silenced_channelGravatar MarkKoz2020-08-17-3/+10
| | | | | | | | |
| * | | | | | | | Silence tests: fix test_silence_private_notifierGravatar MarkKoz2020-08-17-0/+3
| | | | | | | | |
| * | | | | | | | Silence tests: fix test_unsilence_private_for_falseGravatar MarkKoz2020-08-17-1/+4
| | | | | | | | |
| * | | | | | | | Silence tests: fix silence cache test for overwritesGravatar MarkKoz2020-08-17-5/+8
| | | | | | | | |
| * | | | | | | | Silence tests: replace obsolete cog_unload testsGravatar MarkKoz2020-08-17-13/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moderation notifications are no longer sent so that doesn't need to be tested.
| * | | | | | | | Silence tests: rename test_instance_vars to test_init_cogGravatar MarkKoz2020-08-17-5/+5
| | | | | | | | |
| * | | | | | | | Silence tests: mock RedisCachesGravatar MarkKoz2020-08-17-3/+2
| | | | | | | | |
| * | | | | | | | Tests: optionally prevent autospec helper from passing mocksGravatar MarkKoz2020-08-17-19/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not everything that's decorated needs the mocks that are patched. Being required to add the args to the test function anyway is annoying. It's especially bad if trying to decorate an entire test suite, as every test would need the args. Move the definition to a separate module to keep things cleaner.
| * | | | | | | | Silence: rename _get_instance_vars to _init_cogGravatar MarkKoz2020-08-16-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's a more accurate name since it also reschedules unsilences now.
* | | | | | | | | EH tests: Fix InWhitelistCheckFailure import pathGravatar ks1292020-09-27-1/+1
| | | | | | | | |
* | | | | | | | | EH Tests: Fix order of importsGravatar ks1292020-09-27-2/+2
| | | | | | | | |
* | | | | | | | | Merge remote-tracking branch 'upstream/master' into error-handler-testGravatar ks1292020-09-27-988/+2712
|\ \ \ \ \ \ \ \ \ | | |_|/ / / / / / | |/| | | | | | |
| * | | | | | | | Merge pull request #1161 from bast0006/feature-bast-user-token-notifyGravatar Mark2020-09-25-26/+124
| |\ \ \ \ \ \ \ \ | | |_|/ / / / / / | |/| | | | | | | Add userid decoding and user token detection to the token removal moderation feature
| | * | | | | | | Remove redundant is_valid_userid functionGravatar Bast2020-09-25-19/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | extract_user_id(id) is not None does the same job and is not worth the extra function
| | * | | | | | | Change the mod alert message component for the user token detectionGravatar Bast2020-09-24-37/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clean up mock usage, docstrings, unnecessarily split-lined function calls
| | * | | | | | | Add BOT vs USER token detection, properly handling bot tokens for bots in ↵Gravatar Bast2020-09-24-8/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the current server Also adjust the naming and purposes of the format messages to KNOWN and UNKNOWN token messages.
| | * | | | | | | Implement review-suggested changesGravatar Bast2020-09-24-33/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | userid -> user ID maybevalid -> maybe_valid remove collections import and added a new function that handles the "format user ID log message" and should_ping_everyone feature
| | * | | | | | | Merge branch 'master' into feature-bast-user-token-notifyGravatar Bast2020-09-21-101/+462
| | |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resynchronize changes with the new cog folder arrangement
| | * | | | | | | | Make token_remover check basic HMAC validity (not low entropy)Gravatar Bast2020-09-19-5/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handles cases like xxx.xxxxx.xxxxxxxx where a user has intentionally censored part of a token, and will not consider them "valid"
| | * | | | | | | | Add feature to token_remover: log detected user ID, and ping if it's a user ↵Gravatar Bast2020-09-19-6/+39
| | | |_|_|_|_|_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in the server Updated tests This comes with a change that a user ID must actually be able to be decoded into an integer to be considered a valid token