Skip to content

Instantly share code, notes, and snippets.

@manuelep
Last active January 4, 2016 19:19
Show Gist options
  • Save manuelep/8666197 to your computer and use it in GitHub Desktop.
Save manuelep/8666197 to your computer and use it in GitHub Desktop.
a test configuration based on Plomino testing way
# -*- coding: utf-8 -*-
import unittest
from gisweb.doclinkTools.tests.testing import DOCLINKTOOLS_FUNCTIONAL_TESTING
class DoclinktoolsTest(unittest.TestCase):
layer = DOCLINKTOOLS_FUNCTIONAL_TESTING
def setUp(self):
self.portal = self.layer['portal']
self.db = self.portal.mydb
self.portal.portal_membership.addMember(
"user1",
'secret',
('Member',),
'',
{'fullname': "User 1", 'email': 'user1@dummy.fr',}
)
def test_portal_skins_gotscript(self):
doc = self.db.getDocument('doc1')
myscripts = self.portal.portal_skins.gisweb_doclinkTools_scripts.keys()
self.assertIn("doclinkBeforeCreateChild", myscripts)
def test_doc_gotscript(self):
doc = self.db.getDocument('doc1')
self.assertTrue(hasattr(doc, "doclinkBeforeCreateChild"))
# -*- coding: utf-8 -*-
from plone.app.testing import FunctionalTesting
from Products.CMFPlomino.testing import Plomino, z2
class Doclinktools(Plomino):
""" """
def setUpZope(self, app, configurationContext):
Plomino.setUpZope(self, app, configurationContext)
# Load ZCML
import gisweb.doclinkTools
self.loadZCML(package=gisweb.doclinkTools)
# Install product and call its initialize() function
z2.installProduct(app, 'gisweb.doclinkTools')
def setUpPloneSite(self, portal):
# Install into Plone site using portal_setup
self.applyProfile(portal, 'gisweb.doclinkTools:default')
Plomino.setUpPloneSite(self, portal)
def tearDownZope(self, app):
# Uninstall product
z2.uninstallProduct(app, 'gisweb.doclinkTools')
Plomino.tearDownZope(self, app)
DOCLINKTOOLS_FIXTURE = Doclinktools()
DOCLINKTOOLS_FUNCTIONAL_TESTING = FunctionalTesting(bases=(DOCLINKTOOLS_FIXTURE, ), name="Doclinktools:Functional")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment