Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed package installation; added basic test cases for install/uninstall
- Loading branch information
Showing
9 changed files
with
71 additions
and
44 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
Empty file.
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,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
PROJECTNAME = 'collective.weather' |
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
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,3 @@ | ||
<?xml version="1.0"?> | ||
<registry> | ||
</registry> |
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 |
---|---|---|
@@ -1,27 +1,31 @@ | ||
from plone.app.testing import PLONE_FIXTURE | ||
# -*- coding: utf-8 -*- | ||
|
||
from plone.app.testing import PloneSandboxLayer | ||
from plone.app.testing import PLONE_FIXTURE | ||
from plone.app.testing import IntegrationTesting | ||
from plone.app.testing import FunctionalTesting | ||
from plone.app.testing import applyProfile | ||
|
||
from zope.configuration import xmlconfig | ||
|
||
class CollectiveWeather(PloneSandboxLayer): | ||
class Fixture(PloneSandboxLayer): | ||
|
||
defaultBases = (PLONE_FIXTURE, ) | ||
defaultBases = (PLONE_FIXTURE,) | ||
|
||
def setUpZope(self, app, configurationContext): | ||
# Load ZCML for this package | ||
# Load ZCML | ||
import collective.weather | ||
xmlconfig.file('configure.zcml', | ||
collective.weather, | ||
context=configurationContext) | ||
|
||
self.loadZCML(package=collective.weather) | ||
|
||
def setUpPloneSite(self, portal): | ||
applyProfile(portal, 'collective.weather:default') | ||
# Install into Plone site using portal_setup | ||
self.applyProfile(portal, 'collective.weather:default') | ||
|
||
|
||
COLLECTIVE_WEATHER_FIXTURE = CollectiveWeather() | ||
COLLECTIVE_WEATHER_INTEGRATION_TESTING = \ | ||
IntegrationTesting(bases=(COLLECTIVE_WEATHER_FIXTURE, ), | ||
name="CollectiveWeather:Integration") | ||
FIXTURE = Fixture() | ||
INTEGRATION_TESTING = IntegrationTesting( | ||
bases=(FIXTURE,), | ||
name='collective.weather:Integration', | ||
) | ||
FUNCTIONAL_TESTING = FunctionalTesting( | ||
bases=(FIXTURE,), | ||
name='collective.weather:Functional', | ||
) |
This file was deleted.
Oops, something went wrong.
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,35 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import unittest2 as unittest | ||
|
||
from plone.app.testing import TEST_USER_ID | ||
from plone.app.testing import setRoles | ||
|
||
from collective.weather.config import PROJECTNAME | ||
from collective.weather.testing import INTEGRATION_TESTING | ||
|
||
|
||
class InstallTestCase(unittest.TestCase): | ||
|
||
layer = INTEGRATION_TESTING | ||
|
||
def setUp(self): | ||
self.portal = self.layer['portal'] | ||
|
||
def test_installed(self): | ||
qi = getattr(self.portal, 'portal_quickinstaller') | ||
self.assertTrue(qi.isProductInstalled(PROJECTNAME)) | ||
|
||
|
||
class UninstallTest(unittest.TestCase): | ||
|
||
layer = INTEGRATION_TESTING | ||
|
||
def setUp(self): | ||
self.portal = self.layer['portal'] | ||
setRoles(self.portal, TEST_USER_ID, ['Manager']) | ||
self.qi = getattr(self.portal, 'portal_quickinstaller') | ||
self.qi.uninstallProducts(products=[PROJECTNAME]) | ||
|
||
def test_uninstalled(self): | ||
self.assertFalse(self.qi.isProductInstalled(PROJECTNAME)) |