summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTres Seaver <tseaver@palladion.com>2012-12-23 20:54:13 +0000
committerTres Seaver <tseaver@palladion.com>2012-12-23 20:54:13 +0000
commit9246f482134969f880194f5579b81caa726e4109 (patch)
tree94fdf2e80b06775a82735e94a7f92ac3affc5a85
parentcfdd02d6a1bf85524c95ad3ce51800e8c594f5d9 (diff)
downloadzope-security-9246f482134969f880194f5579b81caa726e4109.tar.gz
Fold in a ZCML doctest.
-rw-r--r--docs/api/zcml.rst30
-rw-r--r--src/zope/security/tests/configure.txt24
-rw-r--r--src/zope/security/tests/test_configure.py30
3 files changed, 30 insertions, 54 deletions
diff --git a/docs/api/zcml.rst b/docs/api/zcml.rst
index dbf9179..5fdc3a0 100644
--- a/docs/api/zcml.rst
+++ b/docs/api/zcml.rst
@@ -1,6 +1,36 @@
:mod:`zope.security.zcml`
===============================
+Configuring security via ZCML
+-----------------------------
+
+:mod:`zope.security` provides a ZCML file that configures some utilities and
+a couple of permissions:
+
+.. doctest::
+
+ >>> from zope.component import getGlobalSiteManager
+ >>> from zope.configuration.xmlconfig import XMLConfig
+ >>> import zope.security
+
+ >>> XMLConfig('permissions.zcml', zope.security)()
+
+ >>> len(list(getGlobalSiteManager().registeredUtilities()))
+ 7
+
+Clear the current state:
+
+.. doctest::
+
+ >>> from zope.component.testing import setUp, tearDown
+ >>> tearDown()
+ >>> setUp()
+
+ >>> XMLConfig('configure.zcml', zope.security)()
+
+ >>> len(list(getGlobalSiteManager().registeredUtilities()))
+ 10
+
.. autoclass:: zope.security.zcml.Permission
:members:
:member-order: bysource
diff --git a/src/zope/security/tests/configure.txt b/src/zope/security/tests/configure.txt
deleted file mode 100644
index b7a8e15..0000000
--- a/src/zope/security/tests/configure.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-Package configuration
-=====================
-
-The ``zope.security`` package provides a ZCML file that configures some
-utilities and a couple of permissions:
-
- >>> from zope.configuration.xmlconfig import XMLConfig
- >>> import zope.security
-
- >>> XMLConfig('permissions.zcml', zope.security)()
-
- >>> len(list(zope.component.getGlobalSiteManager().registeredUtilities()))
- 7
-
-Clear the current state:
-
- >>> from zope.component.testing import setUp, tearDown
- >>> tearDown()
- >>> setUp()
-
- >>> XMLConfig('configure.zcml', zope.security)()
-
- >>> len(list(zope.component.getGlobalSiteManager().registeredUtilities()))
- 10
diff --git a/src/zope/security/tests/test_configure.py b/src/zope/security/tests/test_configure.py
deleted file mode 100644
index a384236..0000000
--- a/src/zope/security/tests/test_configure.py
+++ /dev/null
@@ -1,30 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2010 Zope Foundation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-import unittest
-
-
-def test_suite():
- suite = unittest.TestSuite()
-
- try:
- import zope.configuration
- except ImportError:
- pass
- else:
- import doctest
- from zope.component.testing import setUp, tearDown
- suite.addTest(doctest.DocFileSuite('configure.txt',
- setUp=setUp, tearDown=tearDown))
-
- return suite