1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-07 01:41:39 +00:00

Userinfo contactemail (#1894)

* Show contact_email on user profile

I think it would be good to have the edit functionality for that
attribute, too, but I did not implement that right now.
It's marked with TODO though.

* update api and tests

* review
This commit is contained in:
zMingGit
2017-11-14 14:12:27 +08:00
committed by xiez
parent ecd6ccfe20
commit 05caf621f1
6 changed files with 256 additions and 25 deletions

View File

@@ -6,7 +6,8 @@ from tests.common.utils import randstring
from django.core.urlresolvers import reverse
from seahub.constants import DEFAULT_USER, GUEST_USER
from seahub.test_utils import BaseTestCase
from seahub.base.templatetags.seahub_tags import email2nickname
from seahub.base.templatetags.seahub_tags import email2nickname, \
email2contact_email
from seahub.profile.models import DetailedProfile
from seahub.utils.file_size import get_file_size_unit
@@ -243,6 +244,33 @@ class AdminUserTest(BaseTestCase):
assert email2nickname(self.tmp_email) == tmp_name
def test_update_contact_email(self):
self.login_as(self.admin)
# change user name
tmp_email = randstring(10) + '@seafile.test'
data = {'contact_email': tmp_email}
resp = self.client.put(self.url, json.dumps(data),
'application/json')
json_resp = json.loads(resp.content)
self.assertEqual(200, resp.status_code)
assert json_resp['contact_email'] == tmp_email
assert email2contact_email(self.tmp_email) == tmp_email
def test_update_contact_email_with_invalid(self):
self.login_as(self.admin)
# change user name
tmp_email = randstring(10)
data = {'contact_email': tmp_email}
resp = self.client.put(self.url, json.dumps(data),
'application/json')
json_resp = json.loads(resp.content)
self.assertEqual(400, resp.status_code)
def test_update_department(self):
self.login_as(self.admin)