Merge pull request #1493 from normanjaeckel/UserCreate

Added 'id' to user creation response.
This commit is contained in:
Norman Jäckel 2015-02-25 19:38:16 +01:00
commit 35d522d452
2 changed files with 3 additions and 1 deletions

View File

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

View File

@ -18,7 +18,8 @@ class UserCreate(TestCase):
{'last_name': 'Test name keimeiShieX4Aekoe3do'}) {'last_name': 'Test name keimeiShieX4Aekoe3do'})
self.assertEqual(response.status_code, status.HTTP_201_CREATED) 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): def test_creation_with_group(self):
self.client.login(username='admin', password='admin') self.client.login(username='admin', password='admin')