remove notify_* and t_shirt_requested
This commit is contained in:
Родитель
17d4475151
Коммит
680d7b439c
|
@ -4,16 +4,15 @@ from apps.users.models import UserProfile
|
|||
|
||||
|
||||
class UserProfileSerializer(serializers.ModelSerializer):
|
||||
picture_url = serializers.URLField(read_only=True, source='picture_url')
|
||||
|
||||
class Meta:
|
||||
model = UserProfile
|
||||
fields = (
|
||||
'username', 'display_name', 'email',
|
||||
'bio', 'deleted', 'display_collections',
|
||||
'display_collections_fav', 'homepage',
|
||||
'location', 'notes', 'notifycompat',
|
||||
'notifyevents', 'occupation', 'picture_type',
|
||||
'read_dev_agreement', 'last_login_ip',
|
||||
'last_login_attempt', 'last_login_attempt_ip',
|
||||
'failed_login_attempts', 'is_verified',
|
||||
'region', 'lang', 't_shirt_requested'
|
||||
'location', 'notes', 'occupation', 'picture_type',
|
||||
'read_dev_agreement', 'is_verified',
|
||||
'region', 'lang', 'picture_url'
|
||||
)
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
from accounts.serializers import UserProfileSerializer
|
||||
|
||||
from amo.tests import BaseTestCase
|
||||
from users.models import UserProfile
|
||||
|
||||
|
||||
class TestAccountSerializer(BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.user = UserProfile.objects.create(email='a@m.o')
|
||||
|
||||
def test_picture_url(self):
|
||||
serial = UserProfileSerializer(instance=self.user)
|
||||
assert ('anon_user.png' in serial.data['picture_url'])
|
|
@ -1,5 +1,3 @@
|
|||
import json
|
||||
|
||||
from django.core.urlresolvers import resolve, reverse
|
||||
from django.test.utils import override_settings
|
||||
|
||||
|
@ -80,7 +78,7 @@ class TestProfileView(APIAuthTestCase):
|
|||
def test_good(self):
|
||||
res = self.get(self.url)
|
||||
assert res.status_code == 200
|
||||
assert json.loads(res.content)['email'] == 'a@m.o'
|
||||
assert res.data['email'] == 'a@m.o'
|
||||
|
||||
def test_auth_required(self):
|
||||
self.auth_required(self.cls)
|
||||
|
|
|
@ -37,6 +37,4 @@ class ProfileView(JWTProtectedView, generics.RetrieveAPIView):
|
|||
serializer_class = UserProfileSerializer
|
||||
|
||||
def retrieve(self, request, *args, **kw):
|
||||
instance = request.user
|
||||
serializer = self.get_serializer(instance)
|
||||
return Response(serializer.data)
|
||||
return Response(self.get_serializer(request.user).data)
|
||||
|
|
|
@ -39,6 +39,6 @@ class APIAuthTestCase(APITestCase, JWTAuthTester):
|
|||
Tests that the verbs you expect on the class are present and no more.
|
||||
Options is added if you don't pass it.
|
||||
"""
|
||||
verbs = set([v.upper() for v in verbs])
|
||||
verbs = set(v.upper() for v in verbs)
|
||||
verbs.add('OPTIONS')
|
||||
assert not set(cls._allowed_methods(cls())).difference(verbs)
|
||||
|
|
|
@ -38,19 +38,13 @@ Returns information about your profile.
|
|||
"homepage": "https://a.m.o",
|
||||
"location": "Vancouver",
|
||||
"notes": null,
|
||||
"notifycompat": true,
|
||||
"notifyevents": true,
|
||||
"occupation": "",
|
||||
"picture_type": "",
|
||||
"picture_url": "/static/img/anon_user.png",
|
||||
"read_dev_agreement": "2015-11-20T18:36:12",
|
||||
"last_login_ip": "",
|
||||
"last_login_attempt": null,
|
||||
"last_login_attempt_ip": "",
|
||||
"failed_login_attempts": 0,
|
||||
"is_verified": true,
|
||||
"region": null,
|
||||
"lang": "en-US",
|
||||
"t_shirt_requested": null
|
||||
"lang": "en-US"
|
||||
}
|
||||
|
||||
:statuscode 200: profile found.
|
||||
|
|
Загрузка…
Ссылка в новой задаче