def test_user_email(self):
        with self.settings(
                LOGIN_DOMAIN_WHITELIST=['gmail.com'],
                RESTCLIENTS_PWS_DAO_CLASS='restclients.dao_implementation.pws.File'):

            user = PWS().get_person_by_netid('javerage')
            self.assertEquals(user_email(user), '*****@*****.**')

            # non-personal netid
            user = PWS().get_entity_by_netid('somalt')
            self.assertEquals(user_email(user), '*****@*****.**')

            user = get_person_by_gmail_id('*****@*****.**')
            self.assertEquals(user_email(user), '*****@*****.**')

            user = PWS().get_entity_by_netid('somalt')
            user.uwnetid = None
            self.assertRaises(UserPolicyException, user_email, user)

            user = InvalidPerson()
            self.assertRaises(UserPolicyException, user_email, user)