Last change
on this file since 3539 was
3539,
checked in by uli, 16 years ago
|
Fix browser tests.
|
-
Property svn:eol-style set to
native
|
File size:
1.1 KB
|
Rev | Line | |
---|
[3523] | 1 | The waeup package |
---|
[3521] | 2 | ******************** |
---|
| 3 | |
---|
| 4 | :Test-Layer: functional |
---|
| 5 | |
---|
| 6 | University |
---|
| 7 | ========== |
---|
| 8 | |
---|
| 9 | We can watch universities in the browser. |
---|
| 10 | |
---|
| 11 | To make sure, we can 'watch' pages, we first have to initialize out |
---|
| 12 | test browser:: |
---|
| 13 | |
---|
| 14 | >>> from zope.testbrowser.testing import Browser |
---|
| 15 | >>> browser = Browser() |
---|
| 16 | >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
| 17 | >>> browser.handleErrors = False |
---|
| 18 | |
---|
| 19 | We create an university object and put into the ZODB root:: |
---|
| 20 | |
---|
| 21 | >>> root = getRootFolder() |
---|
| 22 | >>> list(root) |
---|
| 23 | [] |
---|
| 24 | |
---|
[3523] | 25 | >>> from waeup.app import University |
---|
[3521] | 26 | >>> u = University() |
---|
| 27 | >>> root['myuniversity'] = u |
---|
| 28 | >>> list(root) |
---|
| 29 | [u'myuniversity'] |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | Let's get the default view of a university:: |
---|
| 33 | |
---|
| 34 | >>> browser.open('http://localhost/myuniversity') |
---|
| 35 | >>> print browser.contents |
---|
[3539] | 36 | <!DOCTYPE html ... |
---|
[3521] | 37 | ...<h1>Congratulations!</h1>... |
---|
| 38 | ... |
---|
| 39 | |
---|
| 40 | We can also get an edit view of a university:: |
---|
| 41 | |
---|
| 42 | >>> browser.open('http://localhost/myuniversity/edit') |
---|
| 43 | >>> print browser.contents |
---|
| 44 | <html>... |
---|
| 45 | ...<form action="http://localhost/myuniversity/edit" |
---|
| 46 | ... |
---|
| 47 | |
---|
| 48 | The edit form contains the default value for the university name:: |
---|
| 49 | |
---|
| 50 | >>> 'Unnamed' in browser.contents |
---|
| 51 | True |
---|
| 52 | |
---|
Note: See
TracBrowser for help on using the repository browser.