django rest framework (2) 썸네일형 리스트형 DRF serializer test code - max_length serializer의 max_length도 테스트해야 할 것 같아서 작성했습니다. 기능상 할 이유가 없을 것 같았지만, 협업을 하면서 다른 팀원이 max_length를 변경하는 경우가 있을 것 같아서 넣었습니다. 실제로 테스트를 실행하는 커맨드는 'python manage.py test app name.directory.file'입니다. from django.test import TestCase from ...serializer.user_serializers import UserUpdateSerializer class TestValidUserUpdateSerializer(TestCase): def setUp(self): self.valid_data = {"last_name": "test", "first_.. DRF token-based vs session based authentication Token-based authentication in Django Rest Framework uses tokens (string) to authenticate clients, while session-based authentication uses sessions (a more complex structure) to authenticate clients. In token-based authentication, the client sends an API request with a token in the header, and the server verifies the token to determine if the client is authenticated. Tokens can be revoked, making.. 이전 1 다음