aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api (follow)
Commit message (Collapse)AuthorAgeLines
* Ignore coverage for infraction serializer unexpectedly succeedingGravatar MarkKoz2019-12-19-2/+2
|
* Add tests for missing active field of infractionsGravatar MarkKoz2019-12-19-0/+28
|
* Remove default value from the active field of infractionsGravatar MarkKoz2019-12-19-10/+37
| | | | | | | | | | | Due to the active field being specified in the UniqueTogetherValidator, the field is implicitly required. Typically default values are excluded from this restriction but in this case some infraction types must always be False. It's easier and makes more sense to require the active field explicitly rather than to write logic in the serializer which is conditional on the type of infractions.
* Output errors more clearly for infraction serializer test failuresGravatar MarkKoz2019-12-18-6/+10
|
* Test that new infractions pass validationGravatar MarkKoz2019-12-18-0/+14
|
* Add fixtures to create infractions in serializer testsGravatar MarkKoz2019-12-18-16/+18
| | | | | The fixtures are invoked manually because not all cases may need the same infractions.
* Add regression test for the UniqueTogetherValidator fixGravatar MarkKoz2019-12-18-0/+41
|
* Infractions: fix UniqueTogetherValidator incorrectly failingGravatar MarkKoz2019-12-18-1/+1
| | | | | | | | | | | | | The active infractions queryset only gets filtered by the fields specified. This meant that if the same user and type had another infraction instance which was active, the validator would fail. The validator assumes failure if it sees any items still in the queryset after filtering. By including the active field in the validator, the queryset will be filtered by the active field too. In the case described above, the queryset would end up empty because a no infractions which are active will ever match an active=False filter.
* Merge pull request #300 from python-discord/#222-offensive-msg-autodeletionGravatar Mark2019-12-14-1/+330
|\ | | | | Create offensive message model for python-discord/bot#617
| * Rename route /bot/offensive-message to /bot/offensive-messagesGravatar Akarys422019-12-14-4/+4
| |
| * Use direct database test intead of relying on GETGravatar Akarys422019-11-16-3/+3
| |
| * Write list test for the offensive message modelGravatar Akarys422019-11-16-0/+39
| |
| * Make use of subtestsGravatar Akarys422019-11-12-20/+20
| | | | | | | | Co-authored-by: Sebastiaan Zeeff <[email protected]>
| * Change setUpTestData to use aware datetimeGravatar Akarys422019-11-11-2/+2
| | | | | | | | This remove a warning during test run
| * Add deletion testsGravatar Akarys422019-11-11-0/+24
| |
| * Add tests to make sure the view return 405 for PATCH and PUT requestsGravatar Akarys422019-11-11-0/+22
| |
| * Make sure the API return the appropriate response.Gravatar Akarys422019-11-10-0/+9
| |
| * Merge master migration filesGravatar Akarys422019-11-07-2/+2
| |
| * Merge branch 'master' into #222-offensive-msg-autodeletionGravatar Akarys422019-11-07-36/+1087
| |\
| * | Block PATCH and PUT methodsGravatar Akarys422019-11-07-3/+2
| | |
| * | Fix copy pasting mistakeGravatar Akarys422019-11-07-1/+1
| | |
| * | Squash down migration filesGravatar Akarys422019-11-07-36/+3
| | |
| * | Write tests for the offensive message model.Gravatar Akarys422019-10-26-3/+70
| | |
| * | Delete unnecessary search filterGravatar Akarys422019-10-26-4/+0
| | |
| * | Change docs to use datetime.datetime instead of datetime.dateGravatar Akarys422019-10-26-2/+2
| | |
| * | Add the offensive message model to the admin panelGravatar Akarys422019-10-26-0/+6
| | |
| * | Fix type error in the future date validatorGravatar Akarys422019-10-25-1/+1
| | |
| * | Add migartion file for OffensiveMssage.delete_dateGravatar Akarys422019-10-25-0/+19
| | |
| * | Add merge migration fileGravatar Akarys422019-10-25-0/+14
| | |
| * | Merge branch 'master' into #222-offensive-msg-autodeletionGravatar Akarys422019-10-25-1/+30
| |\ \
| * | | Change OffensiveMessage.delete_date from datetime.date to datetime.datetimeGravatar Akarys422019-10-25-5/+5
| | | |
| * | | Write tests for the future date validatorGravatar Akarys422019-10-25-0/+12
| | | |
| * | | Create an OffensiveMessage modelGravatar Akarys422019-10-24-1/+156
| | | | | | | | | | | | | | | | This model will be used to store message that triggered a filter and that will be deleted one week after it was sent.
* | | | Correct the discord tos link in rules endpoint.Gravatar scragly2019-11-20-1/+1
| |_|/ |/| |
* | | Resolve migration merge conflictsGravatar Sebastiaan Zeeff2019-11-03-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | Since other pull requests were merged that also included migrations for the API app, this PR needed to be updated to avoid conflicts in the migration history. In addition, the test files contained names of specific migration files that needed to be updated to the correct names after the merge resolution.
* | | Merge branch 'master' into active-infractions-validationGravatar Sebastiaan Zeeff2019-11-03-33/+48
|\ \ \
| * | | Add new rules.Gravatar scragly2019-10-26-32/+18
| | |/ | |/|
| * | Add migrations for the reminder modelGravatar Akarys422019-10-21-0/+19
| | |
| * | Change reminder.jump_url field to URLFieldGravatar Akarys422019-10-21-1/+1
| | | | | | | | | | | | This make sure that the data receivied is valid
| * | Add max_lengh for reminder.jump_urlGravatar Akarys422019-10-19-0/+1
| | |
| * | Add a jump-url field in the reminder modelGravatar Akarys422019-10-19-1/+10
| |/
* | Make test less fragile and improve test nameGravatar Sebastiaan Zeeff2019-10-19-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | The `test_returns_400_for_active_infractions_of_type_that_cannot_be_ active` test relied on the order in which the validation was done since it contained incompatible combinations of arguments. The test has been changed to make sure the data is valid except for the thing we actually want to test. I have also tried to improve the name of the test that tests the `test_unique_constraint_accepts_active_infraction_after_inactive_ infraction` test. It now includes the logic of what it does, but not the entire name of the test it's testing.
* | Fix indentation and missing word in docstringGravatar Sebastiaan Zeeff2019-10-19-3/+3
| | | | | | | | | | | | | | | | | | | | The last two lines in the docstring of `InfractionFactory` in the `test_active_infraction_migration.py` file were overindented by one space. I've removed the space. The docstring of the `test_loader_build_graph_gets_called_once` method in the `MigrationsTestCaseNoSideEffectsTests` calss of the `test_base.py` file was missing two words. Corrected.
* | Apply feedback for pull request #278Gravatar Sebastiaan Zeeff2019-10-19-273/+373
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/python-discord/site/pull/278 This commit applies the feedback given to PR #278. I have made a number of significant changes: - I have added tests for the `MigrationsTestCase` class, including a test to see if the test case travels to the specified points in the migration history. - The dictionary of infracted users in the active migration tests now uses informative strings as keys. This makes it easier to relate a specific test to the data it's testing. - I have simplified the migration query logic by replacing unneeded Q objects by simpler keyword arguments to `filter` method calls. - I have removed the custom validation logic for allowing only one active infraction of a given type per user and replaced it by a `UniqueTogetherValidator` with a custom validation error message. - `test_unique_constraint_accepts_active_infraction_after_inactive_ infraction` relied on an Error results instead of a Fail result to indicate an issue with the database constraint. Since a fail should lead to a Fail status, I've replaced it by a try-except block that signals a test failure if an `IntegrityError` was caught by it.
* | Solve migration conflict by renaming migrationsGravatar Sebastiaan Zeeff2019-10-18-6/+6
| | | | | | | | | | | | | | | | The migration files were generated and named before the migrations added by other pull requests. This caused the migration path to diverge. Since the migrations did not touch the same models, the solution was to rename the migration files to place them at the end of the migration history.
* | Merge branch 'master' into active-infractions-validationGravatar Sebastiaan Zeeff2019-10-18-11/+174
|\|
| * Deny manual `LogEntry` creation.Gravatar Johannes Christ2019-10-11-0/+4
| |
| * Resolve migration merge conflicts.Gravatar Johannes Christ2019-10-11-1/+1
| |
| * Improve formatting for `has_delete_permission`, typespec.Gravatar Johannes Christ2019-10-11-1/+8
| |
| * Merge branch 'master' into simple-admin-log-entry-viewGravatar Johannes Christ2019-10-11-0/+89
| |\