| Conditions | 4 |
| Total Lines | 17 |
| Lines | 17 |
| Ratio | 100 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | import pytest |
||
| 31 | View Code Duplication | @pytest.mark.django_db(transaction=False) |
|
| 32 | def test_valid_token_delete_without_trailing_slash(test_user, settings): |
||
| 33 | from djoser.conf import settings as djoser_settings |
||
| 34 | |||
| 35 | settings.DJOSER = dict( |
||
| 36 | settings.DJOSER, |
||
| 37 | **{'TOKEN_MODEL': 'rest_framework.authtoken.models.Token'} |
||
| 38 | ) |
||
| 39 | djoser_settings.TOKEN_MODEL.objects.get_or_create(user=test_user) |
||
| 40 | assert djoser_settings.TOKEN_MODEL.objects.count() == 1 |
||
| 41 | |||
| 42 | client = APIClient() |
||
| 43 | client.force_login(test_user) |
||
| 44 | response = client.delete('/token') |
||
| 45 | |||
| 46 | assert response.status_code == status.HTTP_204_NO_CONTENT |
||
| 47 | assert djoser_settings.TOKEN_MODEL.objects.count() == 0 |
||
| 48 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.