-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic instalation tests (fixes #23)
- Loading branch information
Showing
4 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from plone.app.testing import FunctionalTesting | ||
from plone.app.testing import IntegrationTesting | ||
from plone.app.testing import PLONE_FIXTURE | ||
from plone.app.testing import PloneSandboxLayer | ||
|
||
|
||
class Fixture(PloneSandboxLayer): | ||
|
||
defaultBases = (PLONE_FIXTURE,) | ||
|
||
def setUpZope(self, app, configurationContext): | ||
# Load ZCML | ||
import Solgema.fullcalendar | ||
self.loadZCML(package=Solgema.fullcalendar) | ||
|
||
def setUpPloneSite(self, portal): | ||
# Install into Plone site using portal_setup | ||
self.applyProfile(portal, 'Solgema.fullcalendar:default') | ||
|
||
FIXTURE = Fixture() | ||
INTEGRATION_TESTING = IntegrationTesting( | ||
bases=(FIXTURE,), | ||
name='Solgema.fullcalendar:Integration', | ||
) | ||
FUNCTIONAL_TESTING = FunctionalTesting( | ||
bases=(FIXTURE,), | ||
name='Solgema.fullcalendar:Functional', | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from plone.app.testing import setRoles | ||
from plone.app.testing import TEST_USER_ID | ||
from plone.browserlayer.utils import registered_layers | ||
from Solgema.fullcalendar.testing import INTEGRATION_TESTING | ||
|
||
import unittest2 as unittest | ||
|
||
PROJECTNAME = 'Solgema.fullcalendar' | ||
|
||
|
||
class InstallTestCase(unittest.TestCase): | ||
|
||
layer = INTEGRATION_TESTING | ||
|
||
def setUp(self): | ||
self.portal = self.layer['portal'] | ||
self.skins = self.portal['portal_skins'] | ||
|
||
def test_installed(self): | ||
qi = self.portal['portal_quickinstaller'] | ||
self.assertTrue(qi.isProductInstalled(PROJECTNAME)) | ||
|
||
def test_addon_layer(self): | ||
layers = [l.getName() for l in registered_layers()] | ||
self.assertIn('ISolgemaFullcalendarLayer', layers) | ||
|
||
def test_skin_layers(self): | ||
self.assertIn('solgemafullcalendar', self.skins) | ||
|
||
|
||
class UninstallTestCase(unittest.TestCase): | ||
|
||
layer = INTEGRATION_TESTING | ||
|
||
def setUp(self): | ||
self.portal = self.layer['portal'] | ||
self.skins = self.portal['portal_skins'] | ||
setRoles(self.portal, TEST_USER_ID, ['Manager']) | ||
self.qi = self.portal['portal_quickinstaller'] | ||
self.qi.uninstallProducts(products=[PROJECTNAME]) | ||
|
||
def test_uninstalled(self): | ||
self.assertFalse(self.qi.isProductInstalled(PROJECTNAME)) | ||
|
||
def test_addon_layer_removed(self): | ||
layers = [l.getName() for l in registered_layers()] | ||
self.assertNotIn('ISolgemaFullcalendarLayer', layers) | ||
|
||
def test_skin_layers_removed(self): | ||
self.assertNotIn('solgemafullcalendar', self.skins) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters