Added 'id' to user creation response.

This commit is contained in:
Norman Jäckel 2015-02-25 16:17:00 +01:00
parent 17afca4568
commit 2ef7c7cf29
2 changed files with 3 additions and 1 deletions

View File

@ -67,6 +67,7 @@ class UserCreateUpdateSerializer(ModelSerializer):
class Meta:
model = User
fields = (
'id',
'is_present',
'username',
'title',

View File

@ -18,7 +18,8 @@ class UserCreate(TestCase):
{'last_name': 'Test name keimeiShieX4Aekoe3do'})
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertTrue(User.objects.filter(username='Test name keimeiShieX4Aekoe3do').exists())
new_user = User.objects.get(username='Test name keimeiShieX4Aekoe3do')
self.assertEqual(response.data['id'], new_user.id)
def test_creation_with_group(self):
self.client.login(username='admin', password='admin')