diff --git a/auth/test/test_basic.py b/auth/test/test_basic.py index 1b55d7dbe..67cc2afc7 100644 --- a/auth/test/test_basic.py +++ b/auth/test/test_basic.py @@ -5,7 +5,8 @@ from base64 import b64encode from auth.basic import validate_basic_auth, ACCESS_TOKEN_USERNAME, OAUTH_TOKEN_USERNAME from auth.validateresult import AuthKind, ValidateResult from data import model -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file + +from test.fixtures import * def _token(username, password): return 'basic ' + b64encode('%s:%s' % (username, password)) diff --git a/auth/test/test_cookie.py b/auth/test/test_cookie.py index 7e13a006f..d0f04e5df 100644 --- a/auth/test/test_cookie.py +++ b/auth/test/test_cookie.py @@ -5,7 +5,7 @@ from flask_login import login_user from app import LoginWrappedDBUser from data import model from auth.cookie import validate_session_cookie -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file +from test.fixtures import * def test_anonymous_cookie(app): assert validate_session_cookie().missing diff --git a/auth/test/test_decorators.py b/auth/test/test_decorators.py index 5de82d3c1..ec6ed28fa 100644 --- a/auth/test/test_decorators.py +++ b/auth/test/test_decorators.py @@ -9,7 +9,7 @@ from auth.auth_context import get_authenticated_user from auth.decorators import (extract_namespace_repo_from_session, require_session_login, process_auth_or_cookie) from data import model -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file +from test.fixtures import * def test_extract_namespace_repo_from_session_missing(app): def emptyfunc(): diff --git a/auth/test/test_oauth.py b/auth/test/test_oauth.py index 5a9d77a8e..bb307459c 100644 --- a/auth/test/test_oauth.py +++ b/auth/test/test_oauth.py @@ -3,7 +3,7 @@ import pytest from auth.oauth import validate_bearer_auth, validate_oauth_token from auth.validateresult import AuthKind, ValidateResult from data import model -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file +from test.fixtures import * @pytest.mark.parametrize('header, expected_result', [ ('', ValidateResult(AuthKind.oauth, missing=True)), diff --git a/auth/test/test_validateresult.py b/auth/test/test_validateresult.py index 1f6523863..993075645 100644 --- a/auth/test/test_validateresult.py +++ b/auth/test/test_validateresult.py @@ -4,7 +4,7 @@ from auth.auth_context import (get_authenticated_user, get_grant_context, get_va get_validated_oauth_token) from auth.validateresult import AuthKind, ValidateResult from data import model -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file +from test.fixtures import * def get_user(): diff --git a/data/model/test/test_repository.py b/data/model/test/test_repository.py index f0265a341..ee6bd0165 100644 --- a/data/model/test/test_repository.py +++ b/data/model/test/test_repository.py @@ -3,9 +3,9 @@ import pytest from peewee import IntegrityError from data.model.repository import create_repository, purge_repository -from test.fixtures import database_uri, init_db_path, sqlitedb_file +from test.fixtures import * -def test_duplicate_repository_different_kinds(database_uri): +def test_duplicate_repository_different_kinds(initialized_db): # Create an image repo. create_repository('devtable', 'somenewrepo', None, repo_kind='image') diff --git a/data/model/test/test_repositoryactioncount.py b/data/model/test/test_repositoryactioncount.py index 7d53ca9ff..bdad4e315 100644 --- a/data/model/test/test_repositoryactioncount.py +++ b/data/model/test/test_repositoryactioncount.py @@ -5,7 +5,7 @@ import pytest from data.database import RepositoryActionCount, RepositorySearchScore from data.model.repository import create_repository from data.model.repositoryactioncount import update_repository_score, SEARCH_BUCKETS -from test.fixtures import database_uri, init_db_path, sqlitedb_file +from test.fixtures import * @pytest.mark.parametrize('bucket_sums,expected_score', [ ((0, 0, 0, 0), 0), @@ -20,7 +20,7 @@ from test.fixtures import database_uri, init_db_path, sqlitedb_file ((300, 500, 1000, 0), 1733), ((5000, 0, 0, 0), 5434), ]) -def test_update_repository_score(bucket_sums, expected_score, database_uri): +def test_update_repository_score(bucket_sums, expected_score, initialized_db): # Create a new repository. repo = create_repository('devtable', 'somenewrepo', None, repo_kind='image') diff --git a/data/model/test/test_tag.py b/data/model/test/test_tag.py index 1a44c25a3..9d372efab 100644 --- a/data/model/test/test_tag.py +++ b/data/model/test/test_tag.py @@ -1,7 +1,7 @@ from data.model.repository import create_repository from data.model.tag import list_active_repo_tags, create_or_update_tag, delete_tag from data.model.image import find_create_or_link_image -from test.fixtures import database_uri, init_db_path, sqlitedb_file +from test.fixtures import * def assert_tags(repository, *args): tags = list(list_active_repo_tags(repository)) @@ -18,7 +18,7 @@ def assert_tags(repository, *args): for expected in args: assert expected in tags_dict -def test_list_active_tags(database_uri): +def test_list_active_tags(initialized_db): # Create a new repository. repository = create_repository('devtable', 'somenewrepo', None) diff --git a/data/model/test/test_user.py b/data/model/test/test_user.py index af87f1a4b..f877806e6 100644 --- a/data/model/test/test_user.py +++ b/data/model/test/test_user.py @@ -1,9 +1,9 @@ from mock import patch from data.model.user import create_user_noverify -from test.fixtures import database_uri, init_db_path, sqlitedb_file +from test.fixtures import * -def test_create_user_with_expiration(database_uri): +def test_create_user_with_expiration(initialized_db): with patch('data.model.config.app_config', {'DEFAULT_TAG_EXPIRATION': '1h'}): user = create_user_noverify('foobar', 'foo@example.com', email_required=False) assert user.removed_tag_expiration_s == 60 * 60 diff --git a/data/test/test_userfiles.py b/data/test/test_userfiles.py index 283539ede..8aabf8d06 100644 --- a/data/test/test_userfiles.py +++ b/data/test/test_userfiles.py @@ -4,7 +4,7 @@ from mock import Mock from io import BytesIO from data.userfiles import DelegateUserfiles, Userfiles -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file +from test.fixtures import * @pytest.mark.parametrize('prefix,path,expected', [ diff --git a/data/users/test/test_teamsync.py b/data/users/test/test_teamsync.py index 51ab82e6f..016a36575 100644 --- a/data/users/test/test_teamsync.py +++ b/data/users/test/test_teamsync.py @@ -5,11 +5,12 @@ import pytest from data import model, database from data.users.federated import FederatedUsers, UserInformation from data.users.teamsync import sync_team, sync_teams_to_groups -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file from test.test_ldap import mock_ldap from test.test_keystone_auth import fake_keystone from util.names import parse_robot_username +from test.fixtures import * + _FAKE_AUTH = 'fake' class FakeUsers(FederatedUsers): diff --git a/endpoints/api/test/test_disallow_for_apps.py b/endpoints/api/test/test_disallow_for_apps.py index de695172a..27d96c8c2 100644 --- a/endpoints/api/test/test_disallow_for_apps.py +++ b/endpoints/api/test/test_disallow_for_apps.py @@ -17,7 +17,7 @@ from endpoints.api.trigger import (BuildTriggerList, BuildTrigger, BuildTriggerS TriggerBuildList, BuildTriggerFieldValues, BuildTriggerSources, BuildTriggerSourceNamespaces) from endpoints.api.test.shared import client_with_identity, conduct_api_call -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file +from test.fixtures import * BUILD_ARGS = {'build_uuid': '1234'} IMAGE_ARGS = {'imageid': '1234', 'image_id': 1234} diff --git a/endpoints/api/test/test_disallow_under_trust.py b/endpoints/api/test/test_disallow_under_trust.py index 0a2f10fbc..2f5f381de 100644 --- a/endpoints/api/test/test_disallow_under_trust.py +++ b/endpoints/api/test/test_disallow_under_trust.py @@ -8,7 +8,7 @@ from endpoints.api.trigger import (BuildTrigger, BuildTriggerSubdirs, BuildTriggerFieldValues, BuildTriggerSources, BuildTriggerSourceNamespaces) from endpoints.api.test.shared import client_with_identity, conduct_api_call -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file +from test.fixtures import * BUILD_ARGS = {'build_uuid': '1234'} IMAGE_ARGS = {'imageid': '1234', 'image_id': 1234} diff --git a/endpoints/api/test/test_organization.py b/endpoints/api/test/test_organization.py index 004d6a8ee..65b9a85d4 100644 --- a/endpoints/api/test/test_organization.py +++ b/endpoints/api/test/test_organization.py @@ -4,7 +4,7 @@ from data import model from endpoints.api import api from endpoints.api.test.shared import client_with_identity, conduct_api_call from endpoints.api.organization import Organization -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file +from test.fixtures import * @pytest.mark.parametrize('expiration, expected_code', [ (0, 200), diff --git a/endpoints/api/test/test_repository.py b/endpoints/api/test/test_repository.py index e3b3050b8..8d48233c3 100644 --- a/endpoints/api/test/test_repository.py +++ b/endpoints/api/test/test_repository.py @@ -1,10 +1,12 @@ import pytest +from mock import patch, ANY, MagicMock + from endpoints.api.test.shared import client_with_identity, conduct_api_call from endpoints.api.repository import RepositoryTrust, Repository from features import FeatureNameValue -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file -from mock import patch, ANY, MagicMock + +from test.fixtures import * INVALID_RESPONSE = { diff --git a/endpoints/api/test/test_security.py b/endpoints/api/test/test_security.py index a65ca7b0e..2ea155367 100644 --- a/endpoints/api/test/test_security.py +++ b/endpoints/api/test/test_security.py @@ -8,7 +8,8 @@ from endpoints.api.superuser import SuperUserRepositoryBuildLogs, SuperUserRepos from endpoints.api.superuser import SuperUserRepositoryBuildStatus from endpoints.api.signing import RepositorySignatures from endpoints.api.repository import RepositoryTrust -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file + +from test.fixtures import * TEAM_PARAMS = {'orgname': 'buynlarge', 'teamname': 'owners'} BUILD_PARAMS = {'build_uuid': 'test-1234'} diff --git a/endpoints/api/test/test_signing.py b/endpoints/api/test/test_signing.py index 056fdad7f..a0320d015 100644 --- a/endpoints/api/test/test_signing.py +++ b/endpoints/api/test/test_signing.py @@ -1,11 +1,12 @@ -from collections import Counter - import pytest +from collections import Counter +from mock import patch + from endpoints.api.test.shared import client_with_identity, conduct_api_call from endpoints.api.signing import RepositorySignatures -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file -from mock import patch + +from test.fixtures import * VALID_TARGETS = { 'latest': { diff --git a/endpoints/api/test/test_team.py b/endpoints/api/test/test_team.py index 4dfa98b7f..c40f8f199 100644 --- a/endpoints/api/test/test_team.py +++ b/endpoints/api/test/test_team.py @@ -7,9 +7,10 @@ from endpoints.api import api from endpoints.api.test.shared import client_with_identity, conduct_api_call from endpoints.api.team import OrganizationTeamSyncing, TeamMemberList from endpoints.api.organization import Organization -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file from test.test_ldap import mock_ldap +from test.fixtures import * + SYNCED_TEAM_PARAMS = {'orgname': 'sellnsmall', 'teamname': 'synced'} UNSYNCED_TEAM_PARAMS = {'orgname': 'sellnsmall', 'teamname': 'owners'} diff --git a/endpoints/appr/test/test_appr_decorators.py b/endpoints/appr/test/test_appr_decorators.py index c71b3107c..77519d6bd 100644 --- a/endpoints/appr/test/test_appr_decorators.py +++ b/endpoints/appr/test/test_appr_decorators.py @@ -4,7 +4,8 @@ from werkzeug.exceptions import HTTPException from data import model from endpoints.appr import require_app_repo_read -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file + +from test.fixtures import * def test_require_app_repo_read(app): called = [False] diff --git a/endpoints/appr/test/test_registry.py b/endpoints/appr/test/test_registry.py index f9c851aeb..6a3037e6c 100644 --- a/endpoints/appr/test/test_registry.py +++ b/endpoints/appr/test/test_registry.py @@ -5,8 +5,8 @@ import pytest from data import model from endpoints.appr.registry import appr_bp -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file +from test.fixtures import * @pytest.mark.parametrize('login_data, expected_code', [ ({ diff --git a/endpoints/oauth/test/test_login.py b/endpoints/oauth/test/test_login.py index f081f84b1..327bdeaa8 100644 --- a/endpoints/oauth/test/test_login.py +++ b/endpoints/oauth/test/test_login.py @@ -4,9 +4,9 @@ from data import model, database from data.users import get_users_handler, DatabaseUsers from endpoints.oauth.login import _conduct_oauth_login from oauth.services.github import GithubOAuthService -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file from test.test_ldap import mock_ldap +from test.fixtures import * @pytest.fixture(params=[None, 'username', 'email']) def login_service(request, app): diff --git a/endpoints/test/test_notificationevent.py b/endpoints/test/test_notificationevent.py index 465589e7f..bf4b5982a 100644 --- a/endpoints/test/test_notificationevent.py +++ b/endpoints/test/test_notificationevent.py @@ -1,10 +1,10 @@ import json from endpoints.notificationevent import NotificationEvent -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file - from util.morecollections import AttrDict +from test.fixtures import * + def test_all_notifications(app): # Create a test notification. test_notification = AttrDict({ diff --git a/workers/test/test_repositoryactioncounter.py b/workers/test/test_repositoryactioncounter.py index 97ae898bc..ed19f1233 100644 --- a/workers/test/test_repositoryactioncounter.py +++ b/workers/test/test_repositoryactioncounter.py @@ -1,7 +1,8 @@ from data import model, database -from test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file from workers.repositoryactioncounter import RepositoryActionCountWorker +from test.fixtures import * + def test_repositoryactioncount(app): database.RepositoryActionCount.delete().execute() database.RepositorySearchScore.delete().execute()