From 4286c4f77a458deadab5ba6bf20736fc1b323ad3 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 10 Feb 2021 18:18:40 +0100 Subject: [PATCH] get UNIXUserController instead of SystemUserBackend and RoundcubeIdentityController instead of PasswdVirtualUserBackend --- .../lists/tests/functional_tests/tests.py | 2 +- .../mailboxes/tests/functional_tests/tests.py | 21 ++++++++-------- .../tests/functional_tests/tests.py | 24 +++++++++---------- .../webapps/tests/functional_tests/tests.py | 7 +++--- 4 files changed, 26 insertions(+), 28 deletions(-) diff --git a/orchestra/contrib/lists/tests/functional_tests/tests.py b/orchestra/contrib/lists/tests/functional_tests/tests.py index ef5aa04c..c222143e 100644 --- a/orchestra/contrib/lists/tests/functional_tests/tests.py +++ b/orchestra/contrib/lists/tests/functional_tests/tests.py @@ -149,7 +149,7 @@ class ListMixin(object): self.update_address_name(name, address_name) self.validate_add(name, address="%s@%s" % (address_name, address_domain)) - @skip("Skip because not exists get_auth_token in orm.api.Api") + # @skip("Skip because not exists get_auth_token in orm.api.Api") def test_delete(self): name = '%s_list' % random_ascii(10) password = '@!?%spppP001' % random_ascii(5) diff --git a/orchestra/contrib/mailboxes/tests/functional_tests/tests.py b/orchestra/contrib/mailboxes/tests/functional_tests/tests.py index 6e90db49..1ca2212a 100644 --- a/orchestra/contrib/mailboxes/tests/functional_tests/tests.py +++ b/orchestra/contrib/mailboxes/tests/functional_tests/tests.py @@ -40,7 +40,7 @@ class MailboxMixin(object): def add_route(self): server = Server.objects.create(name=self.MASTER_SERVER) - backend = backends.PasswdVirtualUserBackend.get_name() + backend = backends.RoundcubeIdentityController.get_name() Route.objects.create(backend=backend, match=True, host=server) backend = backends.PostfixAddressController.get_name() Route.objects.create(backend=backend, match=True, host=server) @@ -49,7 +49,6 @@ class MailboxMixin(object): Resource.objects.create( name='disk', content_type=ContentType.objects.get_for_model(Mailbox), - period=Resource.LAST, verbose_name='Mail quota', unit='MB', scale=10**6, @@ -109,7 +108,7 @@ class MailboxMixin(object): home = Mailbox.objects.get(name=username).get_home() sshrun(self.MASTER_SERVER, "grep '%s' %s/Maildir/new/*" % (token, home), display=False) - @skip("Skip because not exists PasswdVirtualUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_add(self): username = '%s_mailbox' % random_ascii(10) password = '@!?%spppP001' % random_ascii(5) @@ -118,7 +117,7 @@ class MailboxMixin(object): imap = self.login_imap(username, password) self.validate_mailbox(username) - @skip("Skip because not exists PasswdVirtualUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_change_password(self): username = '%s_systemuser' % random_ascii(10) password = '@!?%spppP001' % random_ascii(5) @@ -129,7 +128,7 @@ class MailboxMixin(object): self.change_password(username, new_password) imap = self.login_imap(username, new_password) - @skip("Skip because not exists PasswdVirtualUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_quota(self): username = '%s_mailbox' % random_ascii(10) password = '@!?%spppP001' % random_ascii(5) @@ -144,7 +143,7 @@ class MailboxMixin(object): imap_quota = int(imap.getquotaroot("INBOX")[1][1][0].split(' ')[-1].split(')')[0]) self.assertEqual(quota*1024, imap_quota) - @skip("Skip because not exists PasswdVirtualUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_send_email(self): username = '%s_mailbox' % random_ascii(10) password = '@!?%spppP001' % random_ascii(5) @@ -161,7 +160,7 @@ class MailboxMixin(object): finally: server.quit() - @skip("Skip because not exists PasswdVirtualUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_address(self): username = '%s_mailbox' % random_ascii(10) password = '@!?%spppP001' % random_ascii(5) @@ -175,7 +174,7 @@ class MailboxMixin(object): self.send_email("%s@%s" % (name, domain), token) self.validate_email(username, token) - @skip("Skip because not exists PasswdVirtualUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_disable(self): username = '%s_systemuser' % random_ascii(10) password = '@!?%spppP001' % random_ascii(5) @@ -186,7 +185,7 @@ class MailboxMixin(object): self.disable(username) self.assertRaises(imap.error, self.login_imap, username, password) - @skip("Skip because not exists PasswdVirtualUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_delete(self): username = '%s_systemuser' % random_ascii(10) password = '@!?%sppppP001' % random_ascii(5) @@ -202,7 +201,7 @@ class MailboxMixin(object): self.assertRaises(CommandError, sshrun, self.MASTER_SERVER, 'ls %s' % home, display=False) - @skip("Skip because not exists PasswdVirtualUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_delete_address(self): username = '%s_mailbox' % random_ascii(10) password = '@!?%spppP001' % random_ascii(5) @@ -219,7 +218,7 @@ class MailboxMixin(object): self.send_email("%s@%s" % (name, domain), token) self.validate_email(username, token) - @skip("Skip because not exists PasswdVirtualUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_custom_filtering(self): username = '%s_mailbox' % random_ascii(10) password = '@!?%spppP001' % random_ascii(5) diff --git a/orchestra/contrib/systemusers/tests/functional_tests/tests.py b/orchestra/contrib/systemusers/tests/functional_tests/tests.py index 53dba861..0a3b2a66 100644 --- a/orchestra/contrib/systemusers/tests/functional_tests/tests.py +++ b/orchestra/contrib/systemusers/tests/functional_tests/tests.py @@ -40,7 +40,7 @@ class SystemUserMixin(object): def add_route(self): master = Server.objects.create(name=self.MASTER_SERVER) - backend = backends.SystemUserBackend.get_name() + backend = backends.UNIXUserController.get_name() Route.objects.create(backend=backend, match=True, host=master) def save(self): @@ -105,7 +105,7 @@ class SystemUserMixin(object): self.assertEqual(0, channel.recv_exit_status()) channel.close() - @skip("Skip because not exists SystemUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_add(self): username = '%s_systemuser' % random_ascii(10) password = '@!?%spppP001' % random_ascii(5) @@ -113,7 +113,7 @@ class SystemUserMixin(object): self.addCleanup(self.delete, username) self.validate_user(username) - @skip("Skip because not exists SystemUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_ftp(self): username = '%s_systemuser' % random_ascii(10) password = '@!?%spppP001' % random_ascii(5) @@ -124,7 +124,7 @@ class SystemUserMixin(object): self.assertRaises(paramiko.AuthenticationException, self.validate_ssh, username, password) - @skip("Skip because not exists SystemUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_sftp(self): username = '%s_systemuser' % random_ascii(10) password = '@!?%spppP001' % random_ascii(5) @@ -133,7 +133,7 @@ class SystemUserMixin(object): self.validate_sftp(username, password) self.assertRaises(AssertionError, self.validate_ssh, username, password) - @skip("Skip because not exists SystemUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_ssh(self): username = '%s_systemuser' % random_ascii(10) password = '@!?%spppP001' % random_ascii(5) @@ -141,7 +141,7 @@ class SystemUserMixin(object): self.addCleanup(self.delete, username) self.validate_ssh(username, password) - @skip("Skip because not exists SystemUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_delete(self): username = '%s_systemuser' % random_ascii(10) password = '@!?%sppppP001' % random_ascii(5) @@ -151,7 +151,7 @@ class SystemUserMixin(object): self.validate_delete(username) self.assertRaises(Exception, self.delete, self.account.username) - @skip("Skip because not exists SystemUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_add_group(self): username = '%s_systemuser' % random_ascii(10) password = '@!?%spppP001' % random_ascii(5) @@ -169,7 +169,7 @@ class SystemUserMixin(object): self.assertIn(username2, groups) self.validate_user(username) - @skip("Skip because not exists SystemUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_disable(self): username = '%s_systemuser' % random_ascii(10) password = '@!?%spppP001' % random_ascii(5) @@ -180,7 +180,7 @@ class SystemUserMixin(object): self.validate_user(username) self.assertRaises(ftplib.error_perm, self.validate_ftp, username, password) - @skip("Skip because not exists SystemUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") def test_change_password(self): username = '%s_systemuser' % random_ascii(10) password = '@!?%spppP001' % random_ascii(5) @@ -312,7 +312,7 @@ class RESTSystemUserTest(RESTSystemUserMixin, BaseLiveServerTestCase): class AdminSystemUserTest(AdminSystemUserMixin, BaseLiveServerTestCase): - @skip("Skip because not exists SystemUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") @snapshot_on_error def test_create_account(self): url = self.live_server_url + reverse('admin:accounts_account_add') @@ -348,7 +348,7 @@ class AdminSystemUserTest(AdminSystemUserMixin, BaseLiveServerTestCase): self.addCleanup(self.delete_account, account_username) self.assertEqual(0, sshr(self.MASTER_SERVER, "id %s" % account_username).exit_code) - @skip("Skip because not exists SystemUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") @snapshot_on_error def test_delete_account(self): home = self.account.main_systemuser.get_home() @@ -359,7 +359,7 @@ class AdminSystemUserTest(AdminSystemUserMixin, BaseLiveServerTestCase): self.selenium.delete_all_cookies() self.admin_login() - @skip("Skip because not exists SystemUserBackend") + @skip("Skip because not exists get_auth_token in orm.api.Api") @snapshot_on_error def test_disable_account(self): username = '%s_systemuser' % random_ascii(10) diff --git a/orchestra/contrib/webapps/tests/functional_tests/tests.py b/orchestra/contrib/webapps/tests/functional_tests/tests.py index 282ed86d..fa3bbdc6 100644 --- a/orchestra/contrib/webapps/tests/functional_tests/tests.py +++ b/orchestra/contrib/webapps/tests/functional_tests/tests.py @@ -6,7 +6,7 @@ from unittest import skip from django.conf import settings as djsettings from orchestra.contrib.orchestration.models import Server, Route -# from orchestra.contrib.systemusers.backends import SystemUserBackend +from orchestra.contrib.systemusers.backends import UNIXUserController from orchestra.utils.tests import BaseLiveServerTestCase, random_ascii, snapshot_on_error, save_response_on_error from ... import backends @@ -27,9 +27,8 @@ class WebAppMixin(object): def add_route(self): server, __ = Server.objects.get_or_create(name=self.MASTER_SERVER) - # TODO we don't have SystemUserBackend - # backend = SystemUserBackend.get_name() - # Route.objects.get_or_create(backend=backend, match=True, host=server) + backend = UNIXUserController.get_name() + Route.objects.get_or_create(backend=backend, match=True, host=server) backend = self.backend.get_name() match = 'webapp.type == "%s"' % self.type_value Route.objects.create(backend=backend, match=match, host=server)