Skip to content

Commit

Permalink
adapt test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
sdelcourt committed Apr 24, 2014
1 parent 4c18e5d commit d3fe556
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions plone/app/openid/tests/test_view.py
@@ -1,36 +1,52 @@
import unittest
from plone.app.openid.tests.base import OpenIdTestCase
from Products.PluggableAuthService.interfaces.plugins \
import IExtractionPlugin, ILoginPasswordExtractionPlugin
from Products.PluggableAuthService.interfaces.plugins import IExtractionPlugin
from Products.PluggableAuthService.interfaces.plugins import ILoginPasswordExtractionPlugin

from plone.app.openid.testing import PLONEAPPOPENID_INTEGRATION_TESTING

import unittest2 as unittest


class TestOpenIdView(unittest.TestCase):

layer = PLONEAPPOPENID_INTEGRATION_TESTING

def setUp(self):
self.portal = self.layer['portal']

@property
def pas(self):
return self.portal.acl_users

@property
def pas_info(self):
return self.pas.restrictedTraverse("@@pas_info")

class TestOpenIdView(OpenIdTestCase):
def test_DefaultConfig(self):
pas_info=self.pas_info
pas_info = self.pas_info
self.assertEquals(pas_info.hasOpenIDExtractor(), False)
self.assertEquals(pas_info.hasLoginPasswordExtractor(), True)

def test_OpenIdInstalled(self):
self.portal.portal_setup.runAllImportStepsFromProfile(
'profile-plone.app.openid:default')
pas_info=self.pas_info
pas_info = self.pas_info
self.assertEquals(pas_info.hasOpenIDExtractor(), True)
self.assertEquals(pas_info.hasLoginPasswordExtractor(), True)

def testOnlyOpenIdInstalled(self):
plugins=self.pas.plugins.listPlugins(IExtractionPlugin)
plugins = self.pas.plugins.listPlugins(IExtractionPlugin)
for (id, plugin) in plugins:
if ILoginPasswordExtractionPlugin.providedBy(plugin):
plugin.manage_activateInterfaces(interfaces=())
self.portal.portal_setup.runAllImportStepsFromProfile(
'profile-plone.app.openid:default')

pas_info=self.pas_info
pas_info = self.pas_info
self.assertEquals(pas_info.hasOpenIDExtractor(), True)
self.assertEquals(pas_info.hasLoginPasswordExtractor(), False)


def test_suite():
suite=unittest.TestSuite()
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestOpenIdView))
return suite

0 comments on commit d3fe556

Please sign in to comment.