remove notify_* and t_shirt_requested

This commit is contained in:
Andy McKay 2015-11-23 12:53:04 -08:00
Родитель 17d4475151
Коммит 680d7b439c
6 изменённых файлов: 24 добавлений и 21 удалений

Просмотреть файл

@ -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.