[Checkins] SVN: Sandbox/ulif/grok-adminui/ Fixed tests for admin-UI.
Uli Fouquet
uli at gnufix.de
Wed Jul 11 05:23:49 EDT 2007
Log message for revision 77689:
Fixed tests for admin-UI.
Changed:
U Sandbox/ulif/grok-adminui/buildout.cfg
U Sandbox/ulif/grok-adminui/src/grok/admin/docgrok.py
U Sandbox/ulif/grok-adminui/src/grok/admin/view_templates/appsindex.pt
U Sandbox/ulif/grok-adminui/src/grok/ftests/admin/admin.py
-=-
Modified: Sandbox/ulif/grok-adminui/buildout.cfg
===================================================================
--- Sandbox/ulif/grok-adminui/buildout.cfg 2007-07-11 06:33:29 UTC (rev 77688)
+++ Sandbox/ulif/grok-adminui/buildout.cfg 2007-07-11 09:23:48 UTC (rev 77689)
@@ -60,7 +60,7 @@
[test]
recipe = zc.recipe.testrunner
eggs = grok
-extra-paths = /home/faassen/buildout/z331-lp/lib/python
+#extra-paths = /home/faassen/buildout/z331-lp/lib/python
working-directory = parts/testinstance
defaults = ['--tests-pattern', '^f?tests$',
'-v'
Modified: Sandbox/ulif/grok-adminui/src/grok/admin/docgrok.py
===================================================================
--- Sandbox/ulif/grok-adminui/src/grok/admin/docgrok.py 2007-07-11 06:33:29 UTC (rev 77688)
+++ Sandbox/ulif/grok-adminui/src/grok/admin/docgrok.py 2007-07-11 09:23:48 UTC (rev 77689)
@@ -333,6 +333,8 @@
text = self.apidoc.getDocString()
else:
return None
+ if text is None:
+ return None
lines = text.strip().split('\n')
if len(lines) and heading_only:
# Find first empty line to separate heading from trailing text.
Modified: Sandbox/ulif/grok-adminui/src/grok/admin/view_templates/appsindex.pt
===================================================================
--- Sandbox/ulif/grok-adminui/src/grok/admin/view_templates/appsindex.pt 2007-07-11 06:33:29 UTC (rev 77688)
+++ Sandbox/ulif/grok-adminui/src/grok/admin/view_templates/appsindex.pt 2007-07-11 09:23:48 UTC (rev 77689)
@@ -6,11 +6,11 @@
tal:condition="apps|nothing">
<fieldset
tal:condition="python: len(view.installed_applications)">
- <legend>Installed applications</legend>
- <div tal:repeat="app view/installed_applications">
+ <legend>Installed applications</legend>
+ <div tal:repeat="app view/installed_applications">
<input type="checkbox"
class="checkbox"
- tal:attributes="value app/__name__;
+ tal:attributes="value app/__name__;
name string:items" />
<a tal:attributes="href string:${context/@@absolute_url}/${app/__name__}">
<span tal:replace="app/__name__"/>
@@ -25,13 +25,14 @@
</form>
<fieldset>
<legend>Add application</legend>
- <form action="" tal:attributes="action string:${context/@@absolute_url}/add">
- <div class="menu-box1">
- <div class="menu-box2" tal:repeat="app view/applications">
+ <div class="menu-box1">
+ <form action="" tal:attributes="action string:${context/@@absolute_url}/add"
+ tal:repeat="app view/applications">
+ <div class="menu-box2">
<div class="menu-head1"><a href=""
- tal:attributes="href string:${context/@@absolute_url}/docgrok/${app/docurl}"
- tal:content="app/name">Application Name</a></div>
+ tal:attributes="href string:${context/@@absolute_url}/docgrok/${app/docurl}"
+ tal:content="app/name">Application Name</a></div>
<div class="menu-description1">
<span tal:replace="structure python: view.getDocOfApp(app['name']) or ''">
Application description here.
@@ -44,8 +45,9 @@
<input class="button" type="submit" name="Add" value="Create"/>
</div>
</div>
- </div>
- </form>
+ </form>
+ </div>
+
</fieldset>
</div>
Modified: Sandbox/ulif/grok-adminui/src/grok/ftests/admin/admin.py
===================================================================
--- Sandbox/ulif/grok-adminui/src/grok/ftests/admin/admin.py 2007-07-11 06:33:29 UTC (rev 77688)
+++ Sandbox/ulif/grok-adminui/src/grok/ftests/admin/admin.py 2007-07-11 09:23:48 UTC (rev 77689)
@@ -2,47 +2,60 @@
>>> import grok
>>> grok.grok('grok.ftests.admin.admin')
+We fetch the standard page
+
>>> from zope.testbrowser.testing import Browser
>>> browser = Browser()
>>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
>>> browser.handleErrors = False
>>> browser.open("http://localhost/")
>>> print browser.contents
- <html>
+ <html xmlns="http://www.w3.org/1999/xhtml">
...
- ...<legend>Add application</legend>
+ ... <legend>Add application</legend>
...
- >>> browser.getControl('Application').displayValue = ['grok.ftests.admin.admin.MammothManager']
- >>> browser.getControl('Name').value = 'my-mammoth-manager'
- >>> browser.getControl('Add').click()
+
+ >>> browser.getControl('Name your new app:',index=12).value = 'my-mammoth-manager'
+
+We are able to add a mammoth manager...
+
+ >>> browser.getControl('Create',index=12).click()
+
>>> print browser.contents
- <html>
+ <html xmlns="http://www.w3.org/1999/xhtml">
...
- <li>
- <input type="checkbox" name="items" value="my-mammoth-manager" />
- <a href="http://localhost/my-mammoth-manager">
- my-mammoth-manager
- (MammothManager)
+ ... <legend>Installed applications</legend>
+ ... <input type="checkbox" class="checkbox" name="items"
+ value="my-mammoth-manager" />
+ <a href="http://localhost/my-mammoth-manager">
+ my-mammoth-manager
+ (MammothManager)
</a>
- </li>
+ ... <legend>Add application</legend>
...
- >>> browser.getLink('my-mammoth-manager').click()
+
+Launch the added mammoth manager
+
+ >>> mylink = browser.getLink('my-mammoth-manager (MammothManager)').click()
>>> print browser.contents
Let's manage some mammoths!
-We are able to delete installed applications.
+ >>> print browser.url
+ http://localhost/my-mammoth-manager
+We are able to delete installed mammoth-mnagers
+
>>> browser.open("http://localhost/")
>>> print browser.contents
- <html>
+ <html xmlns="http://www.w3.org/1999/xhtml">
...
- ...<legend>Installed applications</legend>
+ ... <legend>Installed applications</legend>
...
>>> ctrl = browser.getControl(name='items')
>>> ctrl.getControl(value='my-mammoth-manager').selected = True
>>> browser.getControl('Delete Selected').click()
>>> print browser.contents
- <html>
+ <html xmlns="http://www.w3.org/1999/xhtml">
...
...<legend>Add application</legend>
...
@@ -51,6 +64,7 @@
import grok
class MammothManager(grok.Application, grok.Container):
+ """"A mammoth manager"""
pass
class Index(grok.View):
More information about the Checkins
mailing list