def setup_services(): # setup_services separated so that service_provider creation # is decoupled from app creation, allowing test code to # mock the service_provider from pymongo import MongoClient init_logging() db_uri = ConfigStore.MONGO_DB_URI db = MongoClient(db_uri).splash users_svc = UsersService(db, 'users') compounds_svc = CompoundsService(db, 'compounds') teams_svc = TeamsService(db, 'teams') runs_svc = RunsService(teams_svc, TeamRunChecker()) set_auth_services(users_svc) set_compounds_service(compounds_svc) set_runs_service(runs_svc) set_teams_service(teams_svc) set_users_service(users_svc)
def setup_services(): # setup_services separated so that service_provider creation # is decoupled from app creation, allowing test code to # mock the service_provider from pymongo import MongoClient init_logging() db_uri = ConfigStore.MONGO_DB_URI db = MongoClient(db_uri).splash users_svc = UsersService(db, "users") pages_svc = PagesService(db, "pages", "pages_old") references_svc = ReferencesService(db, "references") teams_svc = TeamsService(db, "teams") runs_svc = RunsService(teams_svc, TeamRunChecker()) set_auth_services(users_svc) set_pages_service(pages_svc) set_references_service(references_svc) set_runs_service(runs_svc) set_teams_service(teams_svc) set_users_service(users_svc)
API_URL_ROOT = "/api/v1" os.environ[ "TOKEN_SECRET_KEY"] = "the_question_to_the_life_the_universe_and_everything" os.environ["GOOGLE_CLIENT_ID"] = "Gollum" os.environ["GOOGLE_CLIENT_SECRET"] = "the_one_ring" db = mongomock.MongoClient().db users_svc = UsersService(db, "users") pages_svc = PagesService(db, "pages", "pages_old") references_svc = ReferencesService(db, "references") teams_svc = TeamsService(db, "teams") runs_svc = RunsService(teams_svc, TeamRunChecker()) set_auth_services(users_svc) set_pages_service(pages_svc) set_references_service(references_svc) set_runs_service(runs_svc) set_teams_service(teams_svc) set_users_service(users_svc) def collationMock(self, collation): assert collation.document == {"locale": "en_US"} return self @pytest.fixture(scope="function", autouse=True) def mock_collation_prop(monkeypatch): monkeypatch.setattr(collection.Cursor, "collation", collationMock) @pytest.fixture