adding skip to tests

This commit is contained in:
Cayo Puigdefabregas 2021-02-09 18:16:51 +01:00
parent 3f5ed20926
commit 88193de18a
7 changed files with 59 additions and 9 deletions

View File

@ -1,8 +1,8 @@
import MySQLdb
import os
import socket
import time
from unittest import skip
from django.conf import settings as djsettings
from django.core.management.base import CommandError
from django.core.urlresolvers import reverse
@ -51,6 +51,7 @@ class DatabaseTestMixin(object):
def add_group(self, username, groupname):
raise NotImplementedError
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_add(self):
dbname = '%s_database' % random_ascii(5)
username = '%s_dbuser' % random_ascii(5)
@ -58,6 +59,7 @@ class DatabaseTestMixin(object):
self.add(dbname, username, password)
self.validate_create_table(dbname, username, password)
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_delete(self):
dbname = '%s_database' % random_ascii(5)
username = '%s_dbuser' % random_ascii(5)
@ -69,6 +71,7 @@ class DatabaseTestMixin(object):
self.validate_delete(dbname, username, password)
self.validate_delete_user(dbname, username)
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_change_password(self):
dbname = '%s_database' % random_ascii(5)
username = '%s_dbuser' % random_ascii(5)
@ -82,6 +85,7 @@ class DatabaseTestMixin(object):
self.validate_login_error(dbname, username, password)
self.validate_create_table(dbname, username, new_password)
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_add_user(self):
dbname = '%s_database' % random_ascii(5)
username = '%s_dbuser' % random_ascii(5)
@ -99,6 +103,7 @@ class DatabaseTestMixin(object):
self.validate_create_table(dbname, username, password)
self.validate_create_table(dbname, username2, password2)
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_delete_user(self):
dbname = '%s_database' % random_ascii(5)
username = '%s_dbuser' % random_ascii(5)
@ -118,6 +123,7 @@ class DatabaseTestMixin(object):
self.validate_login_error(dbname, username2, password2)
self.validate_delete_user(username2, password2)
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_swap_user(self):
dbname = '%s_database' % random_ascii(5)
username = '%s_dbuser' % random_ascii(5)

View File

@ -2,6 +2,7 @@ import os
import time
import socket
from functools import partial
from unittest import skip
from django.conf import settings as djsettings
from django.core.urlresolvers import reverse
@ -176,6 +177,7 @@ class DomainTestMixin(object):
self.assertEqual('CNAME', cname[3])
self.assertEqual('external.server.org.', cname[4])
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_add(self):
self.add(self.ns1_name, self.ns1_records)
self.add(self.ns2_name, self.ns2_records)
@ -185,6 +187,7 @@ class DomainTestMixin(object):
time.sleep(1)
self.validate_add(self.SLAVE_SERVER_ADDR, self.domain_name)
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_delete(self):
self.add(self.ns1_name, self.ns1_records)
self.add(self.ns2_name, self.ns2_records)
@ -194,6 +197,7 @@ class DomainTestMixin(object):
self.validate_delete(self.MASTER_SERVER_ADDR, name)
self.validate_delete(self.SLAVE_SERVER_ADDR, name)
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_update(self):
self.add(self.ns1_name, self.ns1_records)
self.add(self.ns2_name, self.ns2_records)
@ -210,6 +214,7 @@ class DomainTestMixin(object):
time.sleep(5)
self.validate_www_update(self.SLAVE_SERVER_ADDR, self.domain_name)
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_add_add_delete_delete(self):
self.add(self.ns1_name, self.ns1_records)
self.add(self.ns2_name, self.ns2_records)
@ -222,6 +227,7 @@ class DomainTestMixin(object):
self.validate_delete(self.MASTER_SERVER_ADDR, self.django_domain_name)
self.validate_delete(self.SLAVE_SERVER_ADDR, self.django_domain_name)
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_bad_creation(self):
self.assertRaises((self.rest.ResponseStatusError, AssertionError),
self.add, self.domain_name, self.domain_records)

View File

@ -2,6 +2,7 @@ import os
import smtplib
import time
import requests
from unittest import skip
from email.mime.text import MIMEText
from django.conf import settings as djsettings
@ -82,6 +83,7 @@ class ListMixin(object):
backend = backends.MailmanController.get_name()
Route.objects.create(backend=backend, match=True, host=server)
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_add(self):
name = '%s_list' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -91,6 +93,7 @@ class ListMixin(object):
self.validate_login(name, password)
self.addCleanup(self.delete, name)
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_add_with_address(self):
name = '%s_list' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -103,6 +106,7 @@ class ListMixin(object):
# Mailman doesn't support changing the address, only the domain
self.validate_add(name, address="%s@%s" % (address_name, address_domain))
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_change_password(self):
name = '%s_list' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -114,6 +118,7 @@ class ListMixin(object):
self.change_password(name, new_password)
self.validate_login(name, new_password)
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_change_domain(self):
name = '%s_list' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -129,6 +134,7 @@ class ListMixin(object):
self.update_domain(name, domain_name)
self.validate_add(name, address="%s@%s" % (address_name, address_domain))
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_change_address_name(self):
name = '%s_list' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -143,6 +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")
def test_delete(self):
name = '%s_list' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)

View File

@ -5,6 +5,7 @@ import smtplib
import time
import textwrap
from email.mime.text import MIMEText
from unittest import skip
from django.apps import apps
from django.conf import settings as djsettings
@ -108,6 +109,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")
def test_add(self):
username = '%s_mailbox' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -116,6 +118,7 @@ class MailboxMixin(object):
imap = self.login_imap(username, password)
self.validate_mailbox(username)
@skip("Skip because not exists PasswdVirtualUserBackend")
def test_change_password(self):
username = '%s_systemuser' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -126,6 +129,7 @@ class MailboxMixin(object):
self.change_password(username, new_password)
imap = self.login_imap(username, new_password)
@skip("Skip because not exists PasswdVirtualUserBackend")
def test_quota(self):
username = '%s_mailbox' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -140,6 +144,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")
def test_send_email(self):
username = '%s_mailbox' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -156,6 +161,7 @@ class MailboxMixin(object):
finally:
server.quit()
@skip("Skip because not exists PasswdVirtualUserBackend")
def test_address(self):
username = '%s_mailbox' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -169,6 +175,7 @@ class MailboxMixin(object):
self.send_email("%s@%s" % (name, domain), token)
self.validate_email(username, token)
@skip("Skip because not exists PasswdVirtualUserBackend")
def test_disable(self):
username = '%s_systemuser' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -179,6 +186,7 @@ class MailboxMixin(object):
self.disable(username)
self.assertRaises(imap.error, self.login_imap, username, password)
@skip("Skip because not exists PasswdVirtualUserBackend")
def test_delete(self):
username = '%s_systemuser' % random_ascii(10)
password = '@!?%sppppP001' % random_ascii(5)
@ -194,6 +202,7 @@ class MailboxMixin(object):
self.assertRaises(CommandError,
sshrun, self.MASTER_SERVER, 'ls %s' % home, display=False)
@skip("Skip because not exists PasswdVirtualUserBackend")
def test_delete_address(self):
username = '%s_mailbox' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -210,6 +219,7 @@ class MailboxMixin(object):
self.send_email("%s@%s" % (name, domain), token)
self.validate_email(username, token)
@skip("Skip because not exists PasswdVirtualUserBackend")
def test_custom_filtering(self):
username = '%s_mailbox' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)

View File

@ -3,6 +3,7 @@ import os
import re
import time
from functools import partial
from unittest import skip
import paramiko
from django.conf import settings as djsettings
@ -104,6 +105,7 @@ class SystemUserMixin(object):
self.assertEqual(0, channel.recv_exit_status())
channel.close()
@skip("Skip because not exists SystemUserBackend")
def test_add(self):
username = '%s_systemuser' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -111,6 +113,7 @@ class SystemUserMixin(object):
self.addCleanup(self.delete, username)
self.validate_user(username)
@skip("Skip because not exists SystemUserBackend")
def test_ftp(self):
username = '%s_systemuser' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -121,6 +124,7 @@ class SystemUserMixin(object):
self.assertRaises(paramiko.AuthenticationException,
self.validate_ssh, username, password)
@skip("Skip because not exists SystemUserBackend")
def test_sftp(self):
username = '%s_systemuser' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -129,6 +133,7 @@ class SystemUserMixin(object):
self.validate_sftp(username, password)
self.assertRaises(AssertionError, self.validate_ssh, username, password)
@skip("Skip because not exists SystemUserBackend")
def test_ssh(self):
username = '%s_systemuser' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -136,6 +141,7 @@ class SystemUserMixin(object):
self.addCleanup(self.delete, username)
self.validate_ssh(username, password)
@skip("Skip because not exists SystemUserBackend")
def test_delete(self):
username = '%s_systemuser' % random_ascii(10)
password = '@!?%sppppP001' % random_ascii(5)
@ -145,6 +151,7 @@ class SystemUserMixin(object):
self.validate_delete(username)
self.assertRaises(Exception, self.delete, self.account.username)
@skip("Skip because not exists SystemUserBackend")
def test_add_group(self):
username = '%s_systemuser' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -162,6 +169,7 @@ class SystemUserMixin(object):
self.assertIn(username2, groups)
self.validate_user(username)
@skip("Skip because not exists SystemUserBackend")
def test_disable(self):
username = '%s_systemuser' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -172,6 +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")
def test_change_password(self):
username = '%s_systemuser' % random_ascii(10)
password = '@!?%spppP001' % random_ascii(5)
@ -303,6 +312,7 @@ class RESTSystemUserTest(RESTSystemUserMixin, BaseLiveServerTestCase):
class AdminSystemUserTest(AdminSystemUserMixin, BaseLiveServerTestCase):
@skip("Skip because not exists SystemUserBackend")
@snapshot_on_error
def test_create_account(self):
url = self.live_server_url + reverse('admin:accounts_account_add')
@ -338,6 +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")
@snapshot_on_error
def test_delete_account(self):
home = self.account.main_systemuser.get_home()
@ -348,6 +359,7 @@ class AdminSystemUserTest(AdminSystemUserMixin, BaseLiveServerTestCase):
self.selenium.delete_all_cookies()
self.admin_login()
@skip("Skip because not exists SystemUserBackend")
@snapshot_on_error
def test_disable_account(self):
username = '%s_systemuser' % random_ascii(10)

View File

@ -1,11 +1,12 @@
import ftplib
import os
from io import StringIO
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 SystemUserBackend
from orchestra.utils.tests import BaseLiveServerTestCase, random_ascii, snapshot_on_error, save_response_on_error
from ... import backends
@ -26,8 +27,9 @@ class WebAppMixin(object):
def add_route(self):
server, __ = Server.objects.get_or_create(name=self.MASTER_SERVER)
backend = SystemUserBackend.get_name()
Route.objects.get_or_create(backend=backend, match=True, host=server)
# TODO we don't have SystemUserBackend
# backend = SystemUserBackend.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)
@ -45,6 +47,7 @@ class WebAppMixin(object):
finally:
ftp.close()
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_add(self):
name = '%s_%s_webapp' % (random_ascii(10), self.type_value)
self.add_webapp(name)
@ -64,7 +67,8 @@ class StaticWebAppMixin(object):
class PHPFcidWebAppMixin(StaticWebAppMixin):
backend = backends.phpfcgid.PHPFcgidBackend
# TODO we don't have phpfcgid
# backend = backends.phpfcgid.PHPFcgidBackend
type_value = 'php5.2'
token = random_ascii(100)
page = (
@ -75,16 +79,18 @@ class PHPFcidWebAppMixin(StaticWebAppMixin):
class PHPFPMWebAppMixin(PHPFcidWebAppMixin):
backend = backends.phpfpm.PHPFPMBackend
# TODO we don't have phpfpm
# backend = backends.phpfpm.PHPFPMBackend
type_value = 'php5.5'
class RESTWebAppMixin(object):
def setUp(self):
super(RESTWebAppMixin, self).setUp()
self.rest_login()
# TODO @cayo not exists get_auth_token in orm.api.Api
# self.rest_login()
# create main user
self.save_systemuser()
# self.save_systemuser()
@save_response_on_error
def save_systemuser(self):

View File

@ -1,8 +1,9 @@
import os
import socket
import requests
from unittest import skip
from orchestra.contrib.domains.models import Domain, Record
from orchestra.contrib.domains.backends import Bind9MasterDomainController
from orchestra.contrib.orchestration.models import Server, Route
@ -35,6 +36,7 @@ class WebsiteMixin(WebAppMixin):
url = 'http://%s/%s' % (domain.name, self.page[0])
self.assertEqual(self.page[2], requests.get(url).content)
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_add(self):
# TODO domains with "_" bad name!
domain_name = '%sdomain.lan' % random_ascii(10)
@ -88,6 +90,7 @@ class RESTWebsiteMixin(RESTWebAppMixin):
class StaticRESTWebsiteTest(RESTWebsiteMixin, StaticWebAppMixin, WebsiteMixin, BaseLiveServerTestCase):
@skip("Skip because not exists get_auth_token in orm.api.Api")
def test_mix_webapps(self):
domain_name = '%sdomain.lan' % random_ascii(10)
domain = Domain.objects.create(name=domain_name, account=self.account)