User Authentication and test for all scenarios#7
Conversation
|
|
||
| urlpatterns = [ | ||
| path("admin/", admin.site.urls), | ||
| # UI (шаблоны) |
There was a problem hiding this comment.
Comments must be writen on English motherfucker do you speak it???????????????????????????????
|
|
||
| class ProfileAPI(generics.RetrieveAPIView): | ||
| serializer_class = ProfileSerializer | ||
| permission_classes = [permissions.IsAuthenticated] # <-- добавляем |
There was a problem hiding this comment.
Comments must be writen on English motherfucker do you speak it???????????????????????????????
|
|
||
|
|
||
| class APIAuthTests(TestCase): | ||
| """Тесты для API эндпоинтов""" |
There was a problem hiding this comment.
Comments must be writen on English motherfucker do you speak it???????????????????????????????
|
|
||
| def test_profile_requires_authentication(self): | ||
| resp = self.client.get(reverse('profile')) | ||
| self.assertEqual(resp.status_code, 302) # редирект на login |
There was a problem hiding this comment.
Comments must be writen on English motherfucker do you speak it???????????????????????????????
|
|
||
|
|
||
| class TemplateAuthTests(TestCase): | ||
| """Тесты для шаблонных (UI) вьюх""" |
There was a problem hiding this comment.
Comments must be writen on English motherfucker do you speak it???????????????????????????????
| path('accounts/', include('accounts.urls')), | ||
|
|
||
| # API | ||
| path('api/', include('accounts.api_urls')), |
There was a problem hiding this comment.
Replace with path('api/accounts', include('accounts.api_urls')),
# Conflicts: # Fools_Arena/urls.py
uxabix
left a comment
There was a problem hiding this comment.
base.html, fix requested previously in main urls.py, comments, PEP8
Surmachov
left a comment
There was a problem hiding this comment.
View uxabix comments and fix what he said.😘
| path('accounts/', include('accounts.urls')), | ||
|
|
||
| # API | ||
| path('api/', include('accounts.api_urls')), |
Surmachov
left a comment
There was a problem hiding this comment.
Make changes what uxabix requested. 🤑
Updated docstrings for authentication tests to provide clearer explanations of each test case, including details about expected behavior and parameters.
No description provided.