diff --git a/core/serializers/accounts.py b/core/serializers/accounts.py index d88ee57da28e55e5b2a76a8787e7391bf725987b..63699b6f4ba606f589619535cfa77d09935b5a2a 100755 --- a/core/serializers/accounts.py +++ b/core/serializers/accounts.py @@ -203,7 +203,7 @@ class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = User fields = ('url', 'username', 'email', 'is_staff', - 'company', 'supervisor', 'student') + 'company', 'supervisor', 'student', 'last_login') class RegisterSerializer(serializers.HyperlinkedModelSerializer): diff --git a/core/tests/test_accounts.py b/core/tests/test_accounts.py index 7dbc8e3f76425447e17de0ac20141123445d2507..bf2231912ae18a207c2596c27e3c6c859c086ce5 100755 --- a/core/tests/test_accounts.py +++ b/core/tests/test_accounts.py @@ -421,3 +421,25 @@ class ProfileUpdateTests(APITestCase): response = self.client.patch(url, {'linkedin_url': 'this is not valid url'}, format='multipart') self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) + +class ResponseApiLoginCompany(APITestCase): + def setUp(self): + self.username = "fesbuk" + self.password = "mo12ni34" + + self.user = User(username=self.username) + self.user.set_password(self.password) + self.user.save() + + def test_field_last_login_exists(self): + response = self.client.post( + '/api/login/', + { + "login-type" : "company", + "password" : self.password, + "username": self.username, + }, + format="json" + ) + + self.assertTrue("last_login" in response.data.keys())