Set env variable to skip REST_API tests.

This commit is contained in:
Santiago L 2021-03-31 10:39:47 +02:00
parent e7aabf4799
commit dc722ec17a
5 changed files with 113 additions and 96 deletions

View File

@ -1,22 +1,24 @@
import MySQLdb
import os
import socket
import time
import unittest
import MySQLdb
from django.conf import settings as djsettings
from django.core.management.base import CommandError
from django.core.urlresolvers import reverse
from selenium.webdriver.support.select import Select
from orchestra.admin.utils import change_url
from orchestra.contrib.orchestration.models import Server, Route
from orchestra.contrib.orchestration.models import Route, Server
from orchestra.utils.sys import sshrun
from orchestra.utils.tests import (BaseLiveServerTestCase, random_ascii, save_response_on_error,
snapshot_on_error)
from orchestra.utils.tests import (BaseLiveServerTestCase, random_ascii,
save_response_on_error, snapshot_on_error)
from selenium.webdriver.support.select import Select
from ... import backends, settings
from ...models import Database, DatabaseUser
TEST_REST_API = int(os.getenv('TEST_REST_API', '0'))
class DatabaseTestMixin(object):
MASTER_SERVER = os.environ.get('ORCHESTRA_SECOND_SERVER', 'localhost')
@ -181,6 +183,7 @@ class MySQLControllerMixin(object):
"""mysql mysql -e 'SELECT * FROM user WHERE user="%(username)s";'""" % context, display=False).stdout)
@unittest.skipUnless(TEST_REST_API, "REST API tests")
class RESTDatabaseMixin(DatabaseTestMixin):
def setUp(self):
super(RESTDatabaseMixin, self).setUp()

View File

@ -1,24 +1,26 @@
import os
import smtplib
import time
import requests
import unittest
from email.mime.text import MIMEText
import requests
from django.conf import settings as djsettings
from django.core.management.base import CommandError
from django.core.urlresolvers import reverse
from selenium.webdriver.support.select import Select
from orchestra.admin.utils import change_url
from orchestra.contrib.domains.models import Domain
from orchestra.contrib.orchestration.models import Server, Route
from orchestra.contrib.orchestration.models import Route, Server
from orchestra.utils.sys import sshrun
from orchestra.utils.tests import (BaseLiveServerTestCase, random_ascii, snapshot_on_error,
save_response_on_error)
from orchestra.utils.tests import (BaseLiveServerTestCase, random_ascii,
save_response_on_error, snapshot_on_error)
from selenium.webdriver.support.select import Select
from ... import backends, settings
from ...models import List
TEST_REST_API = int(os.getenv('TEST_REST_API', '0'))
class ListMixin(object):
MASTER_SERVER = os.environ.get('ORCHESTRA_SLAVE_SERVER', 'localhost')
@ -158,6 +160,7 @@ class ListMixin(object):
self.validate_delete(name)
@unittest.skipUnless(TEST_REST_API, "REST API tests")
class RESTListMixin(ListMixin):
def setUp(self):
super(RESTListMixin, self).setUp()

View File

@ -4,6 +4,7 @@ import poplib
import smtplib
import time
import textwrap
import unittest
from email.mime.text import MIMEText
from django.apps import apps
@ -21,6 +22,8 @@ from orchestra.utils.tests import BaseLiveServerTestCase, random_ascii, snapshot
from ... import backends, settings
from ...models import Mailbox
TEST_REST_API = int(os.getenv('TEST_REST_API', '0'))
class MailboxMixin(object):
MASTER_SERVER = os.environ.get('ORCHESTRA_SLAVE_SERVER', 'localhost')
@ -235,6 +238,7 @@ class MailboxMixin(object):
# TODO test autoreply
@unittest.skipUnless(TEST_REST_API, "REST API tests")
class RESTMailboxMixin(MailboxMixin):
def setUp(self):
super(RESTMailboxMixin, self).setUp()

View File

@ -2,6 +2,7 @@ import ftplib
import os
import re
import time
import unittest
from functools import partial
import paramiko
@ -21,6 +22,7 @@ from ... import backends
from ...models import SystemUser
TEST_REST_API = int(os.getenv('TEST_REST_API', '0'))
r = partial(run, silent=True, display=False)
sshr = partial(sshrun, silent=True, display=False)
@ -185,6 +187,7 @@ class SystemUserMixin(object):
# TODO test resources
@unittest.skipUnless(TEST_REST_API, "REST API tests")
class RESTSystemUserMixin(SystemUserMixin):
def setUp(self):
super(RESTSystemUserMixin, self).setUp()

View File

@ -1,16 +1,19 @@
import ftplib
import os
import unittest
from io import StringIO
from django.conf import settings as djsettings
from orchestra.contrib.orchestration.models import Server, Route
from orchestra.contrib.orchestration.models import Route, Server
from orchestra.contrib.systemusers.backends import UNIXUserController
from orchestra.utils.tests import BaseLiveServerTestCase, random_ascii, snapshot_on_error, save_response_on_error
from orchestra.utils.tests import BaseLiveServerTestCase, random_ascii, save_response_on_error, snapshot_on_error
from ... import backends
TEST_REST_API = int(os.getenv('TEST_REST_API', '0'))
class WebAppMixin(object):
MASTER_SERVER = os.environ.get('ORCHESTRA_MASTER_SERVER', 'localhost')
DEPENDENCIES = (
@ -74,6 +77,7 @@ class PHPFPMWebAppMixin(StaticWebAppMixin):
)
@unittest.skipUnless(TEST_REST_API, "REST API tests")
class RESTWebAppMixin(object):
def setUp(self):
super(RESTWebAppMixin, self).setUp()