1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-22 20:08:19 +00:00

Profile default (#1793)

* profile -> institution test

* fix
This commit is contained in:
zMingGit
2017-09-06 15:35:23 +08:00
committed by xiez
parent e5e5826412
commit 24232c85f7
2 changed files with 19 additions and 1 deletions

View File

@@ -100,7 +100,7 @@ class Profile(models.Model):
login_id = models.CharField(max_length=225, unique=True, null=True, blank=True) login_id = models.CharField(max_length=225, unique=True, null=True, blank=True)
# Contact email is used to receive emails. # Contact email is used to receive emails.
contact_email = models.EmailField(max_length=225, db_index=True, null=True, blank=True) contact_email = models.EmailField(max_length=225, db_index=True, null=True, blank=True)
institution = models.CharField(max_length=225, db_index=True, null=True, blank=True) institution = models.CharField(max_length=225, db_index=True, null=True, blank=True, default='')
objects = ProfileManager() objects = ProfileManager()
def set_lang_code(self, lang_code): def set_lang_code(self, lang_code):

View File

@@ -14,6 +14,7 @@ from seahub.api2.models import TokenV2
class AccountTest(BaseTestCase): class AccountTest(BaseTestCase):
def setUp(self): def setUp(self):
self.clear_cache()
self.user1 = self.create_user('user_%s@test.com' % randstring(4), self.user1 = self.create_user('user_%s@test.com' % randstring(4),
is_staff=False) is_staff=False)
self.user2 = self.create_user('user_%s@test.com' % randstring(4), self.user2 = self.create_user('user_%s@test.com' % randstring(4),
@@ -269,3 +270,20 @@ class AccountTest(BaseTestCase):
resp = self._do_delete() resp = self._do_delete()
self.assertEqual(200, resp.status_code) self.assertEqual(200, resp.status_code)
def test_new_user_get_info_after_edit_profile(self):
new_user = self.create_user("test@new.user", is_staff=True)
self.login_as(new_user)
resp = self.client.post(reverse('edit_profile'), {
'nickname': 'new nickname'
})
resp = self.client.get(reverse('api2-account', args=[new_user.username]))
json_resp = json.loads(resp.content)
assert len(json_resp) == 11
assert json_resp['email'] == new_user.username
assert json_resp['is_staff'] is True
assert json_resp['is_active'] is True
assert json_resp['usage'] == 0
assert json_resp['institution'] == ''
self.remove_user(new_user.username)