Skip to content

Commit

Permalink
add fixture with an additional plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
erral committed Mar 15, 2024
1 parent d8f3040 commit d1a9f9d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
15 changes: 15 additions & 0 deletions tests/services/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from plone.restapi.testing import RelativeSession
from urllib.parse import urlparse
from zope.component.hooks import setSite
from pas.plugins.oidc.plugins import OIDCPlugin

import pytest
import requests
Expand Down Expand Up @@ -102,3 +103,17 @@ def func(url: str):
return qs

return func


@pytest.fixture()
def google(restapi):
portal = restapi["portal"]
setSite(portal)
with api.env.adopt_roles(["Manager", "Member"]):
portal.acl_users._setObject(
"google",
OIDCPlugin("google", "Google")
)

transaction.commit()
yield portal
9 changes: 2 additions & 7 deletions tests/services/test_servides_login_get_multiple_plugins.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
from pas.plugins.oidc.plugins import OIDCPlugin

import pytest


class TestSetupInstall:
@pytest.fixture(autouse=True)
def _initialize(self, portal, api_anon_request):
self.portal = portal
def _initialize(self, google, api_anon_request):
self.portal = google
self.api_session = api_anon_request
self.portal.acl_users._setObject(
"google", OIDCPlugin(id="google", title="Google")
)

def test_login_get_available(self):
response = self.api_session.get("@login")
Expand Down

0 comments on commit d1a9f9d

Please sign in to comment.