[Checkins] SVN: Sandbox/lra/simpleauthtest/ added simpleauthtest,
a test application for megrok.simpleauth
Luciano Ramalho
luciano at ramalho.org
Mon Feb 18 21:20:32 EST 2008
Log message for revision 84043:
added simpleauthtest, a test application for megrok.simpleauth
Changed:
A Sandbox/lra/simpleauthtest/
A Sandbox/lra/simpleauthtest/buildout.cfg
A Sandbox/lra/simpleauthtest/setup.py
A Sandbox/lra/simpleauthtest/src/
A Sandbox/lra/simpleauthtest/src/megrok.simpleauth
A Sandbox/lra/simpleauthtest/src/simpleauthtest/
A Sandbox/lra/simpleauthtest/src/simpleauthtest/__init__.py
A Sandbox/lra/simpleauthtest/src/simpleauthtest/app.py
A Sandbox/lra/simpleauthtest/src/simpleauthtest/app_templates/
A Sandbox/lra/simpleauthtest/src/simpleauthtest/app_templates/index.pt
A Sandbox/lra/simpleauthtest/src/simpleauthtest/configure.zcml
A Sandbox/lra/simpleauthtest/src/simpleauthtest/ftesting.zcml
A Sandbox/lra/simpleauthtest/src/simpleauthtest/ftests/
A Sandbox/lra/simpleauthtest/src/simpleauthtest/ftests/__init__.py
A Sandbox/lra/simpleauthtest/src/simpleauthtest/ftests/index.txt
A Sandbox/lra/simpleauthtest/src/simpleauthtest/ftests/test_functional.py
A Sandbox/lra/simpleauthtest/src/simpleauthtest/testing.py
-=-
Added: Sandbox/lra/simpleauthtest/buildout.cfg
===================================================================
--- Sandbox/lra/simpleauthtest/buildout.cfg (rev 0)
+++ Sandbox/lra/simpleauthtest/buildout.cfg 2008-02-19 02:20:32 UTC (rev 84043)
@@ -0,0 +1,72 @@
+[buildout]
+develop = . src/megrok.simpleauth
+parts = app data zopectl i18n test
+find-links = http://download.zope.org/distribution/
+eggs-directory = /Users/luciano/buildout-eggs
+newest = false
+extends= http://grok.zope.org/releaseinfo/grok-0.11.1.cfg
+versions = versions
+
+[data]
+recipe = zc.recipe.filestorage
+
+[app]
+recipe = zc.zope3recipes>=0.5.3:application
+eggs = simpleauthtest
+ megrok.simpleauth
+site.zcml = <include package="simpleauthtest" />
+ <include package="zope.app.twisted" />
+
+ <configure i18n_domain="simpleauthtest">
+ <unauthenticatedPrincipal id="zope.anybody"
+ title="Unauthenticated User" />
+ <unauthenticatedGroup id="zope.Anybody"
+ title="Unauthenticated Users" />
+ <authenticatedGroup id="zope.Authenticated"
+ title="Authenticated Users" />
+ <everybodyGroup id="zope.Everybody"
+ title="All Users" />
+ <principal id="zope.manager"
+ title="Manager"
+ login="grok"
+ password_manager="Plain Text"
+ password="grok"
+ />
+
+ <!-- Replace the following directive if you don't want
+ public access -->
+ <grant permission="zope.View"
+ principal="zope.Anybody" />
+ <grant permission="zope.app.dublincore.view"
+ principal="zope.Anybody" />
+
+ <role id="zope.Manager" title="Site Manager" />
+ <role id="zope.Member" title="Site Member" />
+ <grantAll role="zope.Manager" />
+ <grant role="zope.Manager"
+ principal="zope.manager" />
+ </configure>
+
+[data]
+recipe = zc.recipe.filestorage
+
+# this section named so that the start/stop script is called bin/zopectl
+[zopectl]
+recipe = zc.zope3recipes:instance
+application = app
+zope.conf = ${data:zconfig}
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = simpleauthtest
+ megrok.simpleauth
+
+defaults = ['--tests-pattern', '^f?tests$', '-v']
+
+# this section named so that the i18n scripts are called bin/i18n...
+[i18n]
+recipe = lovely.recipe:i18n
+package = simpleauthtest
+domain = simpleauthtest
+location = src/simpleauthtest
+output = locales
Added: Sandbox/lra/simpleauthtest/setup.py
===================================================================
--- Sandbox/lra/simpleauthtest/setup.py (rev 0)
+++ Sandbox/lra/simpleauthtest/setup.py 2008-02-19 02:20:32 UTC (rev 84043)
@@ -0,0 +1,28 @@
+from setuptools import setup, find_packages
+
+version = '0.0'
+
+setup(name='simpleauthtest',
+ version=version,
+ description="",
+ long_description="""\
+""",
+ # Get strings from http://www.python.org/pypi?%3Aaction=list_classifiers
+ classifiers=[],
+ keywords="",
+ author="",
+ author_email="",
+ url="",
+ license="",
+ package_dir={'': 'src'},
+ packages=find_packages('src'),
+ include_package_data=True,
+ zip_safe=False,
+ install_requires=['setuptools',
+ 'grok',
+ # Add extra requirements here
+ ],
+ entry_points="""
+ # Add entry points here
+ """,
+ )
Added: Sandbox/lra/simpleauthtest/src/megrok.simpleauth
===================================================================
--- Sandbox/lra/simpleauthtest/src/megrok.simpleauth (rev 0)
+++ Sandbox/lra/simpleauthtest/src/megrok.simpleauth 2008-02-19 02:20:32 UTC (rev 84043)
@@ -0,0 +1 @@
+link /Users/luciano/projetos/megrok.simpleauth
\ No newline at end of file
Property changes on: Sandbox/lra/simpleauthtest/src/megrok.simpleauth
___________________________________________________________________
Name: svn:special
+ *
Added: Sandbox/lra/simpleauthtest/src/simpleauthtest/__init__.py
===================================================================
--- Sandbox/lra/simpleauthtest/src/simpleauthtest/__init__.py (rev 0)
+++ Sandbox/lra/simpleauthtest/src/simpleauthtest/__init__.py 2008-02-19 02:20:32 UTC (rev 84043)
@@ -0,0 +1 @@
+# this directory is a package
Added: Sandbox/lra/simpleauthtest/src/simpleauthtest/app.py
===================================================================
--- Sandbox/lra/simpleauthtest/src/simpleauthtest/app.py (rev 0)
+++ Sandbox/lra/simpleauthtest/src/simpleauthtest/app.py 2008-02-19 02:20:32 UTC (rev 84043)
@@ -0,0 +1,8 @@
+import grok
+from megrok.simpleauth.directives import setup_authentication_if_it_pleases_you_mr_grok
+
+class SimpleAuthTest(grok.Application, grok.Container):
+ setup_authentication_if_it_pleases_you_mr_grok()
+
+class Index(grok.View):
+ pass # see app_templates/index.pt
\ No newline at end of file
Added: Sandbox/lra/simpleauthtest/src/simpleauthtest/app_templates/index.pt
===================================================================
--- Sandbox/lra/simpleauthtest/src/simpleauthtest/app_templates/index.pt (rev 0)
+++ Sandbox/lra/simpleauthtest/src/simpleauthtest/app_templates/index.pt 2008-02-19 02:20:32 UTC (rev 84043)
@@ -0,0 +1,11 @@
+<html>
+<head>
+</head>
+<body>
+ <h1>Congratulations!</h1>
+
+ <p>Your Grok application is up and running.
+ Edit <code>simpleauthtest/app_templates/index.pt</code> to change
+ this page.</p>
+</body>
+</html>
Added: Sandbox/lra/simpleauthtest/src/simpleauthtest/configure.zcml
===================================================================
--- Sandbox/lra/simpleauthtest/src/simpleauthtest/configure.zcml (rev 0)
+++ Sandbox/lra/simpleauthtest/src/simpleauthtest/configure.zcml 2008-02-19 02:20:32 UTC (rev 84043)
@@ -0,0 +1,5 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+ xmlns:grok="http://namespaces.zope.org/grok">
+ <include package="grok" />
+ <grok:grok package="." />
+</configure>
Added: Sandbox/lra/simpleauthtest/src/simpleauthtest/ftesting.zcml
===================================================================
--- Sandbox/lra/simpleauthtest/src/simpleauthtest/ftesting.zcml (rev 0)
+++ Sandbox/lra/simpleauthtest/src/simpleauthtest/ftesting.zcml 2008-02-19 02:20:32 UTC (rev 84043)
@@ -0,0 +1,35 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="simpleauthtest"
+ package="simpleauthtest"
+ >
+
+ <include package="grok" />
+ <include package="simpleauthtest" />
+
+ <!-- Typical functional testing security setup -->
+ <securityPolicy
+ component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy"
+ />
+
+ <unauthenticatedPrincipal
+ id="zope.anybody"
+ title="Unauthenticated User"
+ />
+ <grant
+ permission="zope.View"
+ principal="zope.anybody"
+ />
+
+ <principal
+ id="zope.mgr"
+ title="Manager"
+ login="mgr"
+ password="mgrpw"
+ />
+
+ <role id="zope.Manager" title="Site Manager" />
+ <grantAll role="zope.Manager" />
+ <grant role="zope.Manager" principal="zope.mgr" />
+
+</configure>
Added: Sandbox/lra/simpleauthtest/src/simpleauthtest/ftests/__init__.py
===================================================================
--- Sandbox/lra/simpleauthtest/src/simpleauthtest/ftests/__init__.py (rev 0)
+++ Sandbox/lra/simpleauthtest/src/simpleauthtest/ftests/__init__.py 2008-02-19 02:20:32 UTC (rev 84043)
@@ -0,0 +1 @@
+# this directory is a package
Added: Sandbox/lra/simpleauthtest/src/simpleauthtest/ftests/index.txt
===================================================================
--- Sandbox/lra/simpleauthtest/src/simpleauthtest/ftests/index.txt (rev 0)
+++ Sandbox/lra/simpleauthtest/src/simpleauthtest/ftests/index.txt 2008-02-19 02:20:32 UTC (rev 84043)
@@ -0,0 +1,25 @@
+=====================
+Testing the main page
+=====================
+
+First we setup the app and our test browser, and go to the main page::
+
+ >>> from simpleauthtest.app import SimpleAuthTest
+ >>> root = getRootFolder()
+ >>> app = root['sat'] = SimpleAuthTest()
+ >>> browser = Browser()
+ >>> browser.open('http://localhost/sat/')
+
+Initially, there are no accounts::
+
+ >>> 'Member accounts: 0' in browser.contents
+ True
+
+Now we use the join form to create an account::
+
+ >>> browser.getLink('join').click()
+ >>> browser.getControl(name='form.login').value = 'naoh'
+ >>> browser.getControl(name='form.password').value = 'atra'
+ >>> browser.getControl(name='form.title').value = 'Naoh'
+ >>> browser.getControl(name='form.description').value = 'naoh at gnufix.de'
+ >>> browser.getControl('Save').click()
\ No newline at end of file
Added: Sandbox/lra/simpleauthtest/src/simpleauthtest/ftests/test_functional.py
===================================================================
--- Sandbox/lra/simpleauthtest/src/simpleauthtest/ftests/test_functional.py (rev 0)
+++ Sandbox/lra/simpleauthtest/src/simpleauthtest/ftests/test_functional.py 2008-02-19 02:20:32 UTC (rev 84043)
@@ -0,0 +1,31 @@
+import os
+import unittest
+import simpleauthtest
+from zope.testing import doctest
+from zope.app.testing.functional import (FunctionalTestSetup, ZCMLLayer,
+ getRootFolder, FunctionalDocFileSuite)
+import zope.testbrowser.browser
+import zope.testbrowser.testing
+
+ftesting_zcml = os.path.join(os.path.dirname(simpleauthtest.__file__), 'ftesting.zcml')
+SimpleAuthFunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'SimpleAuthFunctionalLayer')
+
+def test_suite():
+ suite = unittest.TestSuite()
+ docfiles = ['index.txt',]
+
+ for docfile in docfiles:
+ test = FunctionalDocFileSuite(
+ docfile,
+ globs=dict(getRootFolder=getRootFolder, Browser=zope.testbrowser.testing.Browser),
+ optionflags = (doctest.ELLIPSIS
+ | doctest.REPORT_NDIFF
+ | doctest.NORMALIZE_WHITESPACE),)
+ test.layer = SimpleAuthFunctionalLayer
+ suite.addTest(test)
+
+ return suite
+
+if __name__ == '__main__':
+ unittest.main()
+
Added: Sandbox/lra/simpleauthtest/src/simpleauthtest/testing.py
===================================================================
--- Sandbox/lra/simpleauthtest/src/simpleauthtest/testing.py (rev 0)
+++ Sandbox/lra/simpleauthtest/src/simpleauthtest/testing.py 2008-02-19 02:20:32 UTC (rev 84043)
@@ -0,0 +1,7 @@
+import os.path
+import simpleauthtest
+from zope.app.testing.functional import ZCMLLayer
+
+ftesting_zcml = os.path.join(
+ os.path.dirname(simpleauthtest.__file__), 'ftesting.zcml')
+FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer')
More information about the Checkins
mailing list