tests: add __init__ files (#41930)

It prevents collisions between test files with the same basename.
This commit is contained in:
Benjamin Dauvergne 2020-05-11 16:49:36 +02:00
parent 9aea57f36e
commit a5d84366e2
24 changed files with 25 additions and 25 deletions

0
tests/__init__.py Normal file
View File

View File

View File

@ -44,7 +44,7 @@ from authentic2_auth_oidc.utils import has_providers
from authentic2_idp_oidc.models import OIDCClient
from authentic2.authentication import OIDCUser
import utils
from . import utils
Role = get_role_model()

View File

@ -37,7 +37,7 @@ from authentic2.a2_rbac.models import (
from authentic2.utils import get_hex_uuid
from utils import login
from .utils import login
def test_update_rbac(db):

View File

@ -21,7 +21,7 @@ from authentic2.custom_user.models import User
from authentic2.models import Attribute
from django.utils.six.moves.urllib.parse import urlparse
import utils
from . import utils
def test_user_admin(db, app, superuser):

View File

@ -41,7 +41,7 @@ from django_rbac.utils import get_role_model, get_ou_model
from authentic2 import utils, models, attribute_kinds
from utils import Authentic2TestCase, get_response_form, get_link_from_mail
from .utils import Authentic2TestCase, get_response_form, get_link_from_mail
class SerializerTests(TestCase):
@ -293,7 +293,7 @@ class CacheTests(TestCase):
def cache_settings(self, settings):
settings.A2_CACHE_ENABLED = True
@override_settings(ROOT_URLCONF='cache_urls')
@override_settings(ROOT_URLCONF='tests.cache_urls')
def test_cache_decorator_base(self):
import random
from authentic2.decorators import CacheDecoratorBase
@ -343,7 +343,7 @@ class CacheTests(TestCase):
for a in range(2, 10):
self.assertEqual(i(a, a), a)
@override_settings(ROOT_URLCONF='cache_urls')
@override_settings(ROOT_URLCONF='tests.cache_urls')
def test_django_cache(self):
response1 = self.client.get('/django_cache/',
HTTP_HOST='cache1.example.com')
@ -354,7 +354,7 @@ class CacheTests(TestCase):
self.assertNotEqual(response1.content, response2.content)
self.assertEqual(response1.content, response3.content)
@override_settings(ROOT_URLCONF='cache_urls')
@override_settings(ROOT_URLCONF='tests.cache_urls')
def test_session_cache(self):
client = Client()
response1 = client.get('/session_cache/')

View File

@ -41,7 +41,7 @@ from authentic2.a2_rbac.utils import get_default_ou
from authentic2.models import Service, Attribute, AttributeValue, AuthorizedRole
from authentic2.utils import good_next_url
from utils import login, basic_authorization_header, get_link_from_mail
from .utils import login, basic_authorization_header, get_link_from_mail
pytestmark = pytest.mark.django_db

View File

@ -25,7 +25,7 @@ from django.conf import settings
from authentic2.custom_user.models import User
from authentic2.models import Attribute
from utils import get_link_from_mail
from .utils import get_link_from_mail
from webtest import Upload

View File

@ -47,7 +47,7 @@ from authentic2.models import AttributeValue
from authentic2.utils import timestamp_from_datetime, last_authentication_event
from authentic2.a2_rbac.utils import get_default_ou
import utils
from . import utils
pytestmark = pytest.mark.django_db

View File

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import utils
from . import utils
def change_email(app, user, email, mailoutbox):

View File

@ -29,7 +29,7 @@ from authentic2.models import Attribute, DeletedUser
from authentic2_auth_oidc.models import OIDCProvider
from django_rbac.utils import get_ou_model
from utils import login
from .utils import login
if six.PY2:
FileType = file

View File

@ -27,7 +27,7 @@ from authentic2.constants import AUTHENTICATION_EVENTS_SESSION_KEY, NONCE_FIELD_
from authentic2.a2_rbac.utils import get_default_ou
from django_rbac.utils import get_role_model
from utils import Authentic2TestCase
from .utils import Authentic2TestCase
CAS_NAMESPACES = {
'cas': constants.CAS_NAMESPACE,

View File

@ -23,7 +23,7 @@ import pytest
from jwcrypto.jwt import JWT
from jwcrypto.jwk import JWKSet, JWK
import utils
from . import utils
from django import VERSION as DJ_VERSION
from django.core.files import File

View File

@ -46,7 +46,7 @@ from authentic2.saml.models import LibertyProvider, SAMLAttribute
from authentic2.idp.saml.saml2_endpoints import get_extensions, get_login_hints_extension
import lasso
import utils
from . import utils
@pytest.fixture

View File

@ -40,7 +40,7 @@ from authentic2.backends import ldap_backend
from authentic2.utils import authenticate
from authentic2 import crypto, models
import utils
from . import utils
User = get_user_model()

View File

@ -21,7 +21,7 @@ from django.contrib.auth import get_user_model
from authentic2 import models
from utils import login, check_log
from .utils import login, check_log
def test_login_inactive_user(db, app):

View File

@ -34,7 +34,7 @@ from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import force_bytes
from django.utils.six.moves.urllib.parse import urlparse
from utils import login, get_link_from_mail
from .utils import login, get_link_from_mail
pytestmark = pytest.mark.django_db

View File

@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from utils import login
from .utils import login
def test_manager_ou_export(app, admin, ou1, role_ou1, ou2, role_ou2):

View File

@ -16,7 +16,7 @@
from django.test.utils import override_settings
from django.urls import reverse
import utils
from . import utils
def test_send_password_reset_email(app, simple_user, mailoutbox):

View File

@ -19,7 +19,7 @@ from django.urls import reverse
from authentic2.models import Attribute
import utils
from . import utils
pytestmark = pytest.mark.django_db

View File

@ -25,7 +25,7 @@ from django.utils.six.moves.urllib.parse import urlparse
from authentic2 import utils, models
from authentic2.validators import EmailValidator
from utils import get_link_from_mail
from .utils import get_link_from_mail
def test_registration(app, db, settings, mailoutbox, external_redirect):

View File

@ -16,7 +16,7 @@
from django.utils.encoding import force_bytes
from django.utils.encoding import force_text
from utils import login
from .utils import login
def test_manager_role_export(app, admin, ou1, role_ou1, ou2, role_ou2):

View File

@ -33,7 +33,7 @@ from authentic2.a2_rbac.utils import get_default_ou
from authentic2.manager import user_import
from utils import login, get_link_from_mail
from .utils import login, get_link_from_mail
OU = get_ou_model()

View File

@ -16,7 +16,7 @@
# authentic2
import datetime
from utils import login, logout, get_link_from_mail
from .utils import login, logout, get_link_from_mail
import pytest
from django.urls import reverse