Conditions | 4 |
Total Lines | 19 |
Lines | 19 |
Ratio | 100 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | import pytest |
||
10 | View Code Duplication | @pytest.mark.django_db(transaction=False) |
|
11 | def test_valid_token_delete_with_trailing_slash(test_user, settings): |
||
12 | from djoser.conf import settings as djoser_settings |
||
13 | |||
14 | settings.DJOSER = dict( |
||
15 | settings.DJOSER, |
||
16 | **{'TOKEN_MODEL': 'rest_framework.authtoken.models.Token'} |
||
17 | ) |
||
18 | token, _ = djoser_settings.TOKEN_MODEL.objects.get_or_create( |
||
19 | user=test_user |
||
20 | ) |
||
21 | assert djoser_settings.TOKEN_MODEL.objects.count() == 1 |
||
22 | |||
23 | client = APIClient() |
||
24 | client.force_login(test_user) |
||
25 | response = client.delete('/token/') |
||
26 | |||
27 | assert response.status_code == status.HTTP_204_NO_CONTENT |
||
28 | assert djoser_settings.TOKEN_MODEL.objects.count() == 0 |
||
29 | |||
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.