예제 #1
0
        except AttributeError:
            pass
        language_tool.setDefaultLanguage(os.environ.get('LANGUAGE', 'en'))
        populate(portal, language_tool.getDefaultLanguage())


FLOW_FIXTURE = FlowLayer()


class Flow(object):
    """Remote keyword library"""


FLOW_REMOTE_LIBRARY_BUNDLE_FIXTURE = RemoteLibraryLayer(
    bases=(PLONE_FIXTURE, ),
    libraries=(AutoLogin, Users, I18N, MockMailHost, Zope2ServerRemote, Flow),
    name='RemoteLibraryBundle:RobotRemote',
)

FLOW_INTEGRATION_TESTING = IntegrationTesting(
    bases=(FLOW_FIXTURE, ),
    name='FlowLayer:IntegrationTesting',
)

FLOW_FUNCTIONAL_TESTING = FunctionalTesting(
    bases=(FLOW_FIXTURE, ),
    name='FlowLayer:FunctionalTesting',
)

FLOW_ACCEPTANCE_TESTING = FunctionalTesting(
    bases=(
예제 #2
0
        portal.acl_users.userFolderAddUser('admin', 'secret', ['Manager'], [])
        login(portal, 'admin')
        portal.portal_workflow.setDefaultChain("simple_publication_workflow")
        setRoles(portal, TEST_USER_ID, ['Manager'])
        portal.invokeFactory("Folder", id="test-folder", title=u"Test Folder")

    def tearDownPloneSite(self, portal):
        login(portal, 'admin')
        setRoles(portal, TEST_USER_ID, ['Manager'])
        portal.manage_delObjects(['test-folder'])


PRODUCTS_CMFPLONE_FIXTURE = ProductsCMFPloneLayer()

PRODUCTS_CMFPLONE_INTEGRATION_TESTING = IntegrationTesting(
    bases=(PRODUCTS_CMFPLONE_FIXTURE, ), name="CMFPloneLayer:Integration")
PRODUCTS_CMFPLONE_FUNCTIONAL_TESTING = FunctionalTesting(
    bases=(PRODUCTS_CMFPLONE_FIXTURE, ), name="CMFPloneLayer:Functional")

PRODUCTS_CMFPLONE_ROBOT_REMOTE_LIBRARY_FIXTURE = RemoteLibraryLayer(
    bases=(PLONE_FIXTURE, ),
    libraries=(AutoLogin, CMFPloneRemoteKeywords),
    name="CMFPloneRobotRemoteLibrary:RobotRemote")

PRODUCTS_CMFPLONE_ROBOT_TESTING = FunctionalTesting(
    bases=(PRODUCTS_CMFPLONE_FIXTURE,
           PRODUCTS_CMFPLONE_ROBOT_REMOTE_LIBRARY_FIXTURE, z2.ZSERVER_FIXTURE),
    name="CMFPloneLayer:Acceptance")

optionflags = (doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE)
예제 #3
0
        xmlconfig.file('_profiles.zcml',
                       plone.app.robotframework.tests,
                       context=configurationContext)

    def setUpPloneSite(self, portal):
        applyProfile(portal, 'plone.app.robotframework.tests:content')


LIVESEARCH_FIXTURE = LiveSearchLayer()

LIVESEARCH_ROBOT_TESTING = FunctionalTesting(bases=(LIVESEARCH_FIXTURE,
                                                    z2.ZSERVER_FIXTURE),
                                             name="LiveSearch:Robot")

AUTOLOGIN_LIBRARY_FIXTURE = RemoteLibraryLayer(
    bases=(PLONE_FIXTURE, ),
    libraries=(AutoLogin, ),
    name="AutoLoginRemoteLibrary:RobotRemote")

REMOTE_LIBRARY_BUNDLE_FIXTURE = RemoteLibraryLayer(
    bases=(PLONE_FIXTURE, ),
    libraries=(AutoLogin, QuickInstaller),
    name="RemoteLibraryBundle:RobotRemote")

REMOTE_LIBRARY_ROBOT_TESTING = FunctionalTesting(
    bases=(SIMPLE_PUBLICATION_FIXTURE, REMOTE_LIBRARY_BUNDLE_FIXTURE,
           z2.ZSERVER_FIXTURE),
    name="RemoteLibrary:Robot")

AUTOLOGIN_ROBOT_TESTING = FunctionalTesting(bases=(AUTOLOGIN_LIBRARY_FIXTURE,
                                                   z2.ZSERVER_FIXTURE),
                                            name="AutoLogin:Robot")
예제 #4
0
        # Update fields
        data = constructMessageFromSchemata(obj, iterSchemata(obj))
        for key, value in kwargs.items():
            del data[key]
            data[key] = Header(value, 'utf-8')
        del data['language']
        initializeObjectFromSchemata(translation, iterSchemata(obj), data)
        notify(ObjectModifiedEvent(translation))

        # Return uid for the translation
        return IUUID(translation)


REMOTE_LIBRARY_BUNDLE_FIXTURE = RemoteLibraryLayer(
    bases=(PLONE_FIXTURE,),
    libraries=(AutoLogin, Content, MultiLingual),
    name="RemoteLibraryBundle:RobotRemote"
)

PLONE_APP_MULTILINGUAL_ROBOT_TESTING = FunctionalTesting(
    bases=(MULTIPLE_LANGUAGES_LAYER,
           REMOTE_LIBRARY_BUNDLE_FIXTURE,
           z2.ZSERVER_FIXTURE),
    name="plone.app.multilingual:Robot")


PAM_INTEGRATION_TESTING = PLONE_APP_MULTILINGUAL_INTEGRATION_TESTING
PAM_FUNCTIONAL_TESTING = PLONE_APP_MULTILINGUAL_FUNCTIONAL_TESTING
PAM_ROBOT_TESTING = PLONE_APP_MULTILINGUAL_ROBOT_TESTING
예제 #5
0
CASTLE_FIXTURE = CastleLayer()
CASTLE_PLONE_FUNCTIONAL_TESTING = FunctionalTesting(
    bases=(CASTLE_FIXTURE, MOCK_MAILHOST_FIXTURE),
    name="CastleTesting:Functional")
CASTLE_PLONE_INTEGRATION_TESTING = IntegrationTesting(
    bases=(CASTLE_FIXTURE, MOCK_MAILHOST_FIXTURE),
    name="CastleTesting:Integration")

CASTLE_BUNDLE_FIXTURE = RemoteLibraryLayer(
    bases=(PLONE_FIXTURE, ),
    libraries=(
        AutoLogin,
        QuickInstaller,
        GenericSetup,
        Content,
        Users,
        I18N,
        MockMailHost,
        Zope2ServerRemote,
    ),
    name="CastleBundleRobot:RobotRemote",
)

CASTLE_ROBOT_TESTING = RemoteLibraryLayer(bases=(CASTLE_FIXTURE,
                                                 z2.ZSERVER_FIXTURE,
                                                 CASTLE_BUNDLE_FIXTURE),
                                          name="CastleTesting:Robot")


class ResponseWrapper:
    '''Decorates a response object with additional introspective methods.'''
예제 #6
0
class BootstrapTheme(PloneSandboxLayer):

    defaultBases = (PLONE_FIXTURE, )

    def setUpZope(self, app, configurationContext):
        # Load ZCML
        import plonetheme.bootstrap
        self.loadZCML(package=plonetheme.bootstrap)

    def setUpPloneSite(self, portal):
        # Install into Plone site using portal_quickinstaller
        portal.portal_quickinstaller.installProduct('plonetheme.bootstrap')
        # A different install profile will be chosen for Plone>4.1

        portal.portal_css.cookResources()
        portal.portal_javascripts.cookResources()


BOOTSTRAPTHEME_FIXTURE = BootstrapTheme()

CHECK_ERROR_LOG_FIXTURE = RemoteLibraryLayer(
    bases=(PLONE_FIXTURE, ),
    libraries=(CheckErrorLog, AutoLogin),
    name="CheckErrorLogRemoteLibrary:RobotRemote")

BOOTSTRAPTHEME_ROBOT = FunctionalTesting(bases=(CHECK_ERROR_LOG_FIXTURE,
                                                BOOTSTRAPTHEME_FIXTURE,
                                                z2.ZSERVER_FIXTURE),
                                         name='BootstrapTheme:Robot')
예제 #7
0
        if HAS_CSRF_PROTECTION:
            alsoProvides(self.REQUEST, IDisableCSRFProtection)

    def create_type_with_date_field(self, name):
        from plone.dexterity.fti import DexterityFTI
        fti = DexterityFTI(str(name), title=name)
        fti.behaviors = ('plone.app.dexterity.behaviors.metadata.IBasic', )
        fti.model_source = u"""\
<model xmlns="http://namespaces.plone.org/supermodel/schema">
<schema>
<field name="duedate" type="zope.schema.Date">
  <description />
  <required>False</required>
  <title>Due Date</title>
</field>
</schema>
</model>"""
        fti.global_allow = True
        self.portal_types._setObject(str(name), fti)


ROBOT_REMOTE_LIBRARY_FIXTURE = RemoteLibraryLayer(
    bases=(PLONE_FIXTURE, ),
    libraries=(AutoLogin, QuickInstaller, RemoteKeywordsLibrary),
    name='CollectivePFGDexterity:RobotRemote')

ROBOT_TESTING = FunctionalTesting(bases=(COLLECTIVE_PFG_DEXTERITY_FIXTURE,
                                         ROBOT_REMOTE_LIBRARY_FIXTURE,
                                         z2.ZSERVER_FIXTURE),
                                  name='Robot')
예제 #8
0
파일: testing.py 프로젝트: EU-OSHA/HWC14-15
        organisations.setDefaultPage(page.getId())
        page.setLayout('document_organisations_view')


class Debugging:
    """This enables the keyword 'start_debugger'
    
    This keyword (by saily) will enter pdb in the console.
    Unsure how useful that is, but I'll let it stay for the moment.
    """
    def start_debugger(self):
        import pdb
        import sys

        for attr in ('stdin', 'stdout', 'stderr'):
            setattr(sys, attr, getattr(sys, '__%s__' % attr))

        pdb.set_trace()


PDB_LIBRARY_FIXTURE = RemoteLibraryLayer(bases=(PLONE_FIXTURE, ),
                                         libraries=(Debugging, ),
                                         name="osha.hwccontent:RobotRemote")

OSHA_HWCCONTENT_FIXTURE = OSHAHWContentLayer()
OSHA_HWCCONTENT_INTEGRATION_TESTING = IntegrationTesting(
    bases=(OSHA_HWCCONTENT_FIXTURE, ), name="OSHAHWContentLayer:Integration")
OSHA_HWCCONTENT_FUNCTIONAL_TESTING = FunctionalTesting(
    bases=(OSHA_HWCCONTENT_FIXTURE, z2.ZSERVER_FIXTURE, PDB_LIBRARY_FIXTURE),
    name="OSHAHWContentLayer:Functional")
예제 #9
0

class Futures(RemoteLibrary):
    def start_futures_logging(self):
        self._v_record = InstalledHandler('experimental.futures',
                                          level=logging.DEBUG)

    def get_futures_log(self):
        return unicode(self._v_record)

    def stop_futures_logging(self):
        self._v_record.uninstall()


REMOTE_LIBRARY_BUNDLE_FIXTURE = RemoteLibraryLayer(
    bases=(PLONE_FIXTURE, ),
    libraries=(Futures, ),
    name="RemoteLibraryBundle:RobotRemote")


class FuturesTests(PloneSandboxLayer):

    defaultBases = (PLONE_FIXTURE, )

    def setUpZope(self, app, configurationContext):
        import experimental.futures
        self.loadZCML(package=experimental.futures)

        import experimental.futures.tests
        self.loadZCML(package=experimental.futures.tests,
                      name='test_acceptance.zcml')