aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py (unfollow)
Commit message (Collapse)AuthorLines
2020-02-25Scheduler: only send warning in callback if task isn't cancelledGravatar MarkKoz-1/+1
If a task is cancelled it is assumed it was done via cancel_task. That method deletes the task after cancelling so the warning isn't relevant.
2020-02-25Scheduler: properly raise task's exception the done callbackGravatar MarkKoz-1/+4
Task.exception() only returns the exception. It still needs to be explicitly raised.
2020-02-25Scheduler: only delete the task in the done callback if tasks are sameGravatar MarkKoz-16/+25
To prevent a deletion of task rescheduled with the same ID, the callback checks that the stored task is the same as the done task being handled. * Only delete the task; it doesn't need to be cancelled because the it is already done * Revise the callback's docstring to explain the new behaviour * Rename `task` parameter to `done_task`
2020-02-25Scheduler: improve cancel_task's docstringGravatar MarkKoz-5/+5
* Use imperative mood for docstring * Explain the purpose of the parameter in the docstring * Make log message after cog name lowercase
2020-02-25Moderation: use asyncio.shield to prevent self-cancellationGravatar MarkKoz-3/+4
The shield exists to be used for exactly this purpose so its a better fit than create_task.
2020-02-23Sync: code style refactoringGravatar MarkKoz-7/+10
* Convert diff namedtuple to dict outside the dict comprehension * Define long condition as a boolean instead of in the if statement * Pass role and user dicts to aiohttp normally instead of unpacking
2020-02-23Reminders: don't cancel task if reminder is invalid when reschedulingGravatar MarkKoz-6/+11
If a reminder is invalid, it won't get rescheduled. Therefore, there wouldn't exist a task to cancel and it'd raise a warning. Fixes BOT-1C
2020-02-23Add Sentdex server to whitelistGravatar Leon Sandøy-0/+1
2020-02-24Change verification post log level to info, tidy code.Gravatar scragly-14/+13
2020-02-24Reduce log level of tag cooldown notice.Gravatar scragly-2/+4
2020-02-23Remove call to delete reminder, as ensure method already does it.Gravatar scragly-1/+0
2020-02-23Check reminder user and channel before send and schedule.Gravatar scragly-17/+38
2020-02-23Don't log exception traceback on Forbidden for welcomes.Gravatar scragly-12/+9
2020-02-23Don't set project log level so it uses root level.Gravatar scragly-1/+1
2020-02-23Define `_count` in `__init__`.Gravatar scragly-0/+1
2020-02-23Suppress NotFound on react clear, tidy imports.Gravatar scragly-18/+21
2020-02-21Change defcon log levels from warning to infoGravatar Joseph Banks-2/+2
2020-02-21Enable logging warnings to SentryGravatar Joseph Banks-3/+12
2020-02-21Bot: send empty cache warning to a webhookGravatar MarkKoz-3/+12
This is more visible than it would be if it was only logged. * Add a webhook for the dev-log channel to constants
2020-02-21Attach jump_to url to the eventGravatar Joseph Banks-0/+8
2020-02-21Use push_scope instead of configure_scopeGravatar Joseph Banks-2/+2
2020-02-21Use log.error instead of capture_exceptionGravatar Joseph Banks-2/+2
2020-02-21Remove AIOHTTP integration from Sentry since it is intended for AIOHTTP servers.Gravatar Joseph Banks-3/+1
2020-02-21Remove tests for custom bot logGravatar Joseph Banks-62/+2
2020-02-21Remove the space that makes the test failGravatar Deniz-1/+1
2020-02-21Use the code provided by sco1 to fix the checks failing.Gravatar Deniz-5/+10
2020-02-21Add basic sentry usage for command errors giving user information and ↵Gravatar Joseph Banks-85/+10
command context.
2020-02-21Attach extra information on a command errorGravatar Joseph Banks-1/+13
2020-02-21Set BOT_SENTRY_DSN environment variable for testsGravatar Joseph Banks-1/+1
2020-02-21Implement basic Sentry SDK usageGravatar Joseph Banks-2/+14
2020-02-20Update flake8-annotations to v2.0.Gravatar scragly-10/+51
2020-02-20Change to explicit logs, remove logmatic.Gravatar scragly-160/+76
2020-02-19API: add comment explaining class attributesGravatar MarkKoz-0/+2
Explain changes caused by 22a55534ef13990815a6f69d361e2a12693075d5.
2020-02-19Sync: add confirmation timeout and max diff to configGravatar MarkKoz-16/+24
2020-02-19Moderation: show avatar in infraction deactivation logGravatar MarkKoz-0/+5
2020-02-17Pagination migrations - Emoji Data Structure ModifiedGravatar F4zi-1/+1
Changed the pagination emoji collection from list to tuple This change was suggested since this collection is constant
2020-02-17Change snekbox api url to internal docker domain.Gravatar scragly-1/+1
NGINX has been dockerised, and proxy passes now reference internal container domains rather than referencing host or external domains. This will have a few extra benefits: - Less external factors involved for resolving the service address - Can work with the same address on development envs - Snekbox can be closed down entirely so it's inaccessible from external networks.
2020-02-16Fix missing Django logs when using Docker ComposeGravatar MarkKoz-0/+2
Fixed by allocating a pseudo-tty to the web and bot services in Docker Compose.
2020-02-15Scheduler: make _scheduled_tasks privateGravatar MarkKoz-6/+6
Main concern is someone trying to cancel a task directly. The workaround for the race condition relies on the task only being cancelled via Scheduler.cancel_task(), particularly because it removes the task from the dictionary. The done callback will not remove from the dictionary if it sees the task has already been cancelled. So it's a bad idea to cancel tasks directly...
2020-02-15Moderation: avoid prematurely cancelling deactivation taskGravatar MarkKoz-1/+3
Because deactivate_infraction() explicitly cancels the scheduled task, it now runs in a separate task to avoid prematurely cancelling itself.
2020-02-15Scheduler: cancel the task in the callbackGravatar MarkKoz-12/+30
This design makes more sense and is more convenient than requiring tasks to be responsible for cancelling themselves. * Rename _handle_task_exception to _task_done_callback * Add trace logging
2020-02-15Scheduler: raise task exceptions besides CancelledErrorGravatar MarkKoz-4/+7
Explicitly retrieves the task's exception, which will raise the exception if one exists. * Rename _suppress_cancelled_error to _handle_task_exception
2020-02-15Scheduler: remove loop parameter from schedule_taskGravatar MarkKoz-16/+9
asyncio.create_task() exists and will already use the running loop in the current thread. Because there is no intention of using a different loop in a different thread anywhere in the program for the foreseeable future, the loop parameter is redundant.
2020-02-15Scheduler: correct schedule_task's docstringGravatar MarkKoz-1/+1
2020-02-15Scheduler: remove create_task functionGravatar MarkKoz-15/+7
It's redundant because the done callback only takes a single line to add and can be added in schedule_task(). * Use Task as the type hint rather than Future for _suppress_cancelled_error()
2020-02-15Scheduler: fix #754 - only suppress CancelledErrorGravatar MarkKoz-6/+7
2020-02-15Moderation: show member as a mention in expired infraction logGravatar MarkKoz-1/+1
2020-02-15Moderation: show correct actor in expired infraction logGravatar MarkKoz-3/+4
The bot user was always being used instead of using the actor field of the infraction.
2020-02-15Moderation: add creation date & duration to expired infraction logGravatar MarkKoz-1/+7
Closes #685
2020-02-15Utils: refactor format_infraction_with_duration and support absolute valGravatar MarkKoz-13/+23
The absolute value is useful for preventing negative values in the case that date_to is in the past relative to date_from. * Add an absolute parameter to take the absolute value of the duration * Rename expiry to date_to * Rewrite the docstring