# -*- coding: utf-8 -*-
{{% if plone.is_plone5 %}}
from plone.app.contenttypes.testing import PLONE_APP_CONTENTTYPES_FIXTURE
{{% endif %}}
from plone.app.robotframework.testing import REMOTE_LIBRARY_BUNDLE_FIXTURE
from plone.app.testing import (
    applyProfile,
    FunctionalTesting,
    IntegrationTesting,
{{% if not plone.is_plone5 %}}
    PLONE_FIXTURE,
{{% endif %}}
    PloneSandboxLayer,
)
from plone.testing import z2

import {{{ package.dottedname }}}


class {{{ package.browserlayer }}}(PloneSandboxLayer):

{{% if plone.is_plone5 %}}
    defaultBases = (PLONE_APP_CONTENTTYPES_FIXTURE,)
{{% endif %}}
{{% if not plone.is_plone5 %}}
    defaultBases = (PLONE_FIXTURE,)
{{% endif %}}

    def setUpZope(self, app, configurationContext):
        # Load any other ZCML that is required for your tests.
        # The z3c.autoinclude feature is disabled in the Plone fixture base
        # layer.
{{% if not plone.is_plone5 %}}
        import plone.app.dexterity
        self.loadZCML(package=plone.app.dexterity)
{{% endif %}}
        import plone.restapi
        self.loadZCML(package=plone.restapi)
        self.loadZCML(package={{{ package.dottedname }}})

    def setUpPloneSite(self, portal):
        applyProfile(portal, '{{{ package.dottedname }}}:default')


{{{package.uppercasename}}}_FIXTURE = {{{ package.browserlayer }}}()


{{{package.uppercasename}}}_INTEGRATION_TESTING = IntegrationTesting(
    bases=({{{package.uppercasename}}}_FIXTURE,),
    name='{{{ package.browserlayer }}}:IntegrationTesting',
)


{{{package.uppercasename}}}_FUNCTIONAL_TESTING = FunctionalTesting(
    bases=({{{package.uppercasename}}}_FIXTURE,),
    name='{{{ package.browserlayer }}}:FunctionalTesting',
)


{{{package.uppercasename}}}_ACCEPTANCE_TESTING = FunctionalTesting(
    bases=(
        {{{package.uppercasename}}}_FIXTURE,
        REMOTE_LIBRARY_BUNDLE_FIXTURE,
        z2.ZSERVER_FIXTURE,
    ),
    name='{{{ package.browserlayer }}}:AcceptanceTesting',
)
