Ejemplo n.º 1
0
    def test_get_user_info_by_pk(self):
        try:
            user_info = hydroshare.get_user_info(self.user.pk)
        except:
            raise ValueError("get user info using user pk doesn't work.")
        else:
            # test user username
            self.assertEqual(
                user_info['username'],
                self.user.username,
                msg='obtained username is not correct'
            )

            # test user email
            self.assertEqual(
                user_info['email'],
                self.user.email,
                msg='obtained email is not correct'
            )

            # test user name
            self.assertEqual(
                user_info['last_name'],
                self.user.last_name,
                msg='user last name is not correct'
            )

            self.assertEqual(
                user_info['first_name'],
                self.user.first_name,
                msg='user first name is not correct'
            )
Ejemplo n.º 2
0
    def test_get_user_info_by_obj(self):
        user_info = hydroshare.get_user_info(self.user)
        # print serializers.serialize('json', User.objects.all())

        # test user username
        self.assertEqual(
            user_info['username'],
            self.user.username,
            msg='user username is not correct'
        )

        # test user email
        self.assertEqual(
            user_info['email'],
            self.user.email,
            msg='user email is not correct'
        )

        # test user name
        self.assertEqual(
            user_info['last_name'],
            self.user.last_name,
            msg='user last name is not correct'
        )

        self.assertEqual(
            user_info['first_name'],
            self.user.first_name,
            msg='user first name is not correct'
        )
Ejemplo n.º 3
0
    def test_get_user_info_by_obj(self):
        user_info = hydroshare.get_user_info(self.user)
        # print serializers.serialize('json', User.objects.all())

        # test user username
        self.assertEqual(user_info['username'],
                         self.user.username,
                         msg='user username is not correct')

        # test user email
        self.assertEqual(user_info['email'],
                         self.user.email,
                         msg='user email is not correct')

        # test user name
        self.assertEqual(user_info['last_name'],
                         self.user.last_name,
                         msg='user last name is not correct')

        self.assertEqual(user_info['first_name'],
                         self.user.first_name,
                         msg='user first name is not correct')
Ejemplo n.º 4
0
    def test_get_user_info_by_pk(self):
        try:
            user_info = hydroshare.get_user_info(self.user.pk)
        except:
            raise ValueError("get user info using user pk doesn't work.")
        else:
            # test user username
            self.assertEqual(user_info['username'],
                             self.user.username,
                             msg='obtained username is not correct')

            # test user email
            self.assertEqual(user_info['email'],
                             self.user.email,
                             msg='obtained email is not correct')

            # test user name
            self.assertEqual(user_info['last_name'],
                             self.user.last_name,
                             msg='user last name is not correct')

            self.assertEqual(user_info['first_name'],
                             self.user.first_name,
                             msg='user first name is not correct')
Ejemplo n.º 5
0
 def get_user_info(self, pk):
     return json_or_jsonp(self.request, hydroshare.get_user_info(pk))
Ejemplo n.º 6
0
 def get_user_info(self, pk):
     return json_or_jsonp(self.request, hydroshare.get_user_info(pk))