aboutsummaryrefslogtreecommitdiffstats
path: root/tests (follow)
Commit message (Collapse)AuthorAgeLines
* Merge branch 'master' into moderation-cleanupGravatar Sebastiaan Zeeff2019-10-08-0/+126
|\
| * Merge branch 'master' into add-role-info-commandGravatar Chris G2019-10-04-0/+78
| |\
| | * Check if tzinfo is None in ISODateTime testGravatar Sebastiaan Zeeff2019-10-03-1/+3
| | | | | | | | | | | | | | | | | | | | | As we have decided that the converter should return naive datetime objects, we should explicitly test that datetime strings with a timezone offset are still converted to a naive datetime object. I have done this by adding a `tzinfo is None` assertion.
| | * Make ISODateTime return tz-unaware datetimeGravatar Sebastiaan Zeeff2019-10-02-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The parser we use, `dateutil.parsers.isoparse` returns a timezone- aware or timezone-unaware `datetime` object depending on whether or not the datetime string included a timezone offset specification. Since we can't compare tz-aware objects to tz-unaware objects it's better to make sure our converter is consistent in the type it will return. For now, I've chosen to return tz-unaware datetime objects, since `discord.py` also returns tz-unaware datetime objects when accessing datetime-related attributes of objects. Since we're likely to compare "our" datetime objects to discord.py-provided datetime objects, I think that's the most parsimonious option for now. Note: It's probably a good idea to open a larger discussion about using timezone-aware datetime objects throughout the library to avoid a UTC-time being interpreted as localtime. This will require a broader discussion than this commit/PR allows, though.
| | * Apply docstring review suggestionGravatar Sebastiaan Zeeff2019-10-02-1/+1
| | | | | | | | | Co-Authored-By: Mark <[email protected]>
| | * Add converter for ISO-formatted datetime stringsGravatar Sebastiaan Zeeff2019-10-01-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related to https://github.com/python-discord/bot/issues/458 This commit adds a converter that automatically parses ISO-formatted datetime strings and returns a `datetime.datetime` object. It uses `dateutil.parser.isoparse` to do the heavy lifting, so it supports the same formats as this method. In addition, I have added tests that ensure that it accepts certain formats and added a description of these 'guaranteed' formats to the `ISODate.convert` docstring. This commit should make it easy to implement #485
| * | Merge branch 'add-role-info-command' of github.com:python-discord/bot into ↵Gravatar Joseph Banks2019-10-01-15/+108
| |\ \ | | | | | | | | | | | | add-role-info-command
| | * | Merge branch 'master' into add-role-info-commandGravatar S. Co12019-10-01-15/+108
| | |\|
| * | | Make tests work with Union converterGravatar Joseph Banks2019-10-01-3/+4
| |/ /
| * | Add unit tests for role info commandGravatar Joseph Banks2019-09-21-0/+47
| | |
* | | Fix stars.json resource testGravatar MarkKoz2019-10-01-8/+3
| |/ |/|
* | Allow whitespace in duration strings and update testsGravatar Sebastiaan Zeeff2019-09-23-47/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/python-discord/bot/issues/446 After review feedback and a discussion in the dev-core team, I've changed a couple of things: - Allow a space between amount and unit in the duration string; - Allow a space between different units in the duration string; - Remove the old ExpirationDate converter completely; - Remove the dependency `dateparser` from the Pipfile; - Update tests for the two types of optional spaces; - Change the test for valid cases to a more readable format; This PR closes #446
* | Fix failing duration conversionGravatar Sebastiaan Zeeff2019-09-23-4/+78
|/ | | | | | | | | | | | | | | | | | | https://github.com/python-discord/bot/issues/446 The current ExpirationDate converter does not convert duration strings to `datetime.datetime` objects correctly. To remedy the problem, I've written a new Duration converter that uses regex matching to extract the relevant duration units and `dateutil.relativedelta.relativedelta` to compute a `datetime.datetime` that's the given duration in the future. I've left the old `ExpirationDate` converter in place for now, since the new Duration converter may not be the most optimal method. However, given the importance of being able to convert durations for moderation tasks, I think it's better to implement Duration now and rethink the approach later. This commit closes #446
* Add tests for `bot.rules.attachments`.Gravatar Johannes Christ2019-09-18-0/+52
| | | | This also fixes an issue with the `attachments` rule not respecting the most recent message sent by a user.
* Add basic tests for `bot.cogs.information`.Gravatar Johannes Christ2019-09-18-0/+195
|
* Recombine import groups.Gravatar scragly2019-09-18-1/+0
|
* Add basic tests for `bot.api`.Gravatar Johannes Christ2019-09-18-1/+127
|
* Validate configuration against typehints.Gravatar Johannes Christ2019-09-18-0/+23
|
* Add tests for `bot.converters`. (#418)Gravatar scragly2019-09-18-0/+93
|\ | | | | Add tests for `bot.converters`.
| * Add tests for `bot.converters`.Gravatar Johannes Christ2019-09-15-0/+93
| |
* | Merge pull request #422 from python-discord/bot-utils-checks-use-fixtureGravatar scragly2019-09-18-16/+15
|\ \ | | | | | | Use `@pytest.fixture` for creating contexts.
| * | Use `@pytest.fixture` for creating contexts.Gravatar Johannes Christ2019-09-15-16/+15
| | |
* | | Merge pull request #430 from python-discord/bot-cogs-security-testsGravatar Johannes Christ2019-09-15-0/+54
|\ \ \ | | | | | | | | Add tests for `bot.cogs.security`.
| * | | Add tests for `bot.cogs.security`.Gravatar Johannes Christ2019-09-15-0/+54
| | | |
* | | | Merge pull request #428 from python-discord/bot-cogs-token-remover-testsGravatar Johannes Christ2019-09-15-0/+143
|\ \ \ \ | |/ / / |/| | | Add tests for `bot.cogs.token_remover`.
| * | | Add tests for `bot.cogs.token_remover`.Gravatar Johannes Christ2019-09-15-0/+143
| | | |
* | | | Validate `bot/resources/stars.json` in tests.Gravatar Johannes Christ2019-09-15-0/+18
|/ / /
* | | Merge pull request #423 from python-discord/bot-pagination-testsGravatar Johannes Christ2019-09-15-0/+29
|\ \ \ | | | | | | | | Add basic tests for `bot.pagination`.
| * | | Add basic tests for `bot.pagination`.Gravatar Johannes Christ2019-09-15-0/+29
| |/ /
* | | Merge pull request #417 from python-discord/validate-antispam-config-in-ciGravatar Johannes Christ2019-09-15-0/+30
|\ \ \ | |/ / |/| | Validate bot.cogs.antispam configuration on CI.
| * | Validate bot.cogs.antispam configuration on CI.Gravatar Johannes Christ2019-09-15-0/+30
| |/
* / Add tests for `bot.utils.checks`.Gravatar Johannes Christ2019-09-15-0/+67
|/
* Updating role sync tests for position and adding tests for deletion detectionGravatar Sebastiaan Zeeff2019-08-15-21/+60
|
* Fix the linting issues with Bot so builds will work.Gravatar Scragly2019-03-09-1/+2
|
* Add test case for deduplication of `in_guild` field update.Gravatar Johannes Christ2019-01-03-0/+7
|
* Add role and user differ unit tests.Gravatar Johannes Christ2019-01-03-0/+125