mirror of
https://github.com/haiwen/seahub.git
synced 2025-04-28 03:10:45 +00:00
Delete user option (#1979)
* Remove user all options * delete space * delete space * debug sapce
This commit is contained in:
parent
1c6092cc58
commit
4b7ec9de27
@ -331,6 +331,13 @@ class User(object):
|
||||
if settings.ENABLE_TERMS_AND_CONDITIONS:
|
||||
from termsandconditions.models import UserTermsAndConditions
|
||||
UserTermsAndConditions.objects.filter(username=username).delete()
|
||||
self.delete_user_options(username)
|
||||
|
||||
def delete_user_options(self, username):
|
||||
"""Remove user's all options.
|
||||
"""
|
||||
from seahub.options.models import UserOptions
|
||||
UserOptions.objects.filter(email=username).delete()
|
||||
|
||||
def get_and_delete_messages(self):
|
||||
messages = []
|
||||
|
@ -1,6 +1,7 @@
|
||||
from seahub.test_utils import BaseTestCase
|
||||
from seahub.base.accounts import User, RegistrationForm
|
||||
|
||||
from seahub.options.models import UserOptions
|
||||
from post_office.models import Email
|
||||
|
||||
class UserTest(BaseTestCase):
|
||||
@ -16,6 +17,20 @@ class UserTest(BaseTestCase):
|
||||
# email = Email.objects.all()[0]
|
||||
# print email.html_message
|
||||
|
||||
def test_delete_user_options(self):
|
||||
test_email = '123@123.com'
|
||||
|
||||
assert len(UserOptions.objects.filter(email=test_email)) == 0
|
||||
|
||||
User.objects.create_user(test_email)
|
||||
UserOptions.objects.enable_server_crypto(test_email)
|
||||
|
||||
assert len(UserOptions.objects.filter(email=test_email)) == 1
|
||||
|
||||
user = User.objects.get(email=test_email)
|
||||
user.delete()
|
||||
|
||||
assert len(UserOptions.objects.filter(email=test_email)) == 0
|
||||
|
||||
class UserPermissionsTest(BaseTestCase):
|
||||
def test_permissions(self):
|
||||
|
Loading…
Reference in New Issue
Block a user