- Timestamp:
- 13 Nov 2014, 16:54:17 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/browser.txt
r11952 r11954 4 4 Here we visit all parts of a Ikoba portal using a browser. 5 5 6 Institution 6 Company 7 7 ========== 8 8 9 9 We can watch universities in the browser. 10 10 11 We create an institutionobject and put into the ZODB root::11 We create an company object and put into the ZODB root:: 12 12 13 13 >>> root = getRootFolder() … … 15 15 [] 16 16 17 >>> from waeup.ikoba.app import Institution18 >>> u = Institution()19 >>> root['my institution'] = u17 >>> from waeup.ikoba.app import Company 18 >>> u = Company() 19 >>> root['mycompany'] = u 20 20 >>> list(root) 21 [u'my institution']21 [u'mycompany'] 22 22 23 23 >>> from zope.component.hooks import setSite 24 >>> setSite(root['my institution'])24 >>> setSite(root['mycompany']) 25 25 26 26 To make sure, we can 'watch' pages, we first have to initialize out … … 30 30 >>> browser = Browser() 31 31 32 Let's get the default view of a institution::33 34 >>> browser.open('http://localhost/my institution')32 Let's get the default view of a company:: 33 34 >>> browser.open('http://localhost/mycompany') 35 35 >>> print browser.contents 36 36 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... … … 55 55 The contact form for anonymous users is called 'Enquiries':: 56 56 57 >>> browser.open('http://localhost/my institution')57 >>> browser.open('http://localhost/mycompany') 58 58 >>> browser.getLink('Enquiries').click() 59 59 >>> browser.getControl('Send').click() … … 74 74 Registered users with an email address can request a password change: 75 75 76 >>> root['my institution']['users'].addUser('forgetful', 'secret',title='Bob Forgetful',76 >>> root['mycompany']['users'].addUser('forgetful', 'secret',title='Bob Forgetful', 77 77 ... description='A forgetful user', email='aa@aa.ng') 78 >>> browser.open('http://localhost/my institution/changepw')78 >>> browser.open('http://localhost/mycompany/changepw') 79 79 >>> browser.getControl(name="form.identifier").value = 'forgetful' 80 80 >>> browser.getControl(name="form.email").value = 'aa@aa.ng' … … 91 91 We can then get an edit view of the configuration container:: 92 92 93 >>> browser.open('http://localhost/my institution/configuration')94 >>> print browser.contents 95 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 96 ...<form action="http://localhost/my institution/configuration/@@index"97 ... 98 99 The edit form contains the default value for the institutionname::100 101 >>> 'Sample Institution' in browser.contents93 >>> browser.open('http://localhost/mycompany/configuration') 94 >>> print browser.contents 95 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 96 ...<form action="http://localhost/mycompany/configuration/@@index" 97 ... 98 99 The edit form contains the default value for the company name:: 100 101 >>> 'Sample Company' in browser.contents 102 102 True 103 103 … … 110 110 ... 111 111 112 >>> browser.open('http://localhost/my institution/configuration')112 >>> browser.open('http://localhost/mycompany/configuration') 113 113 >>> browser.getControl("Update plugins").click() 114 114 >>> print browser.contents … … 120 120 and is properly rendered on the frontpage of the portal: 121 121 122 >>> browser.open('http://localhost/my institution')122 >>> browser.open('http://localhost/mycompany') 123 123 >>> print browser.contents 124 124 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... … … 134 134 If we change to German so that the German part of frontpage.rst is rendered: 135 135 136 >>> browser.open('http://localhost/my institution//@@change_language?lang=de')136 >>> browser.open('http://localhost/mycompany//@@change_language?lang=de') 137 137 >>> print browser.contents 138 138 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... … … 147 147 Switch back to English: 148 148 149 >>> browser.open('http://localhost/my institution//@@change_language?lang=en')149 >>> browser.open('http://localhost/mycompany//@@change_language?lang=en') 150 150 151 151 … … 153 153 ============ 154 154 155 >>> browser.open('http://localhost/my institution')155 >>> browser.open('http://localhost/mycompany') 156 156 >>> browser.getLink('Portal Users').click() 157 157 >>> print browser.contents … … 187 187 manually by setting the roles attribute: 188 188 189 >>> print root['my institution']['users']['bob'].roles189 >>> print root['mycompany']['users']['bob'].roles 190 190 [] 191 >>> root['my institution']['users']['bob'].roles = ['waeup.UsersManager']192 >>> print root['my institution']['users']['bob'].roles191 >>> root['mycompany']['users']['bob'].roles = ['waeup.UsersManager'] 192 >>> print root['mycompany']['users']['bob'].roles 193 193 ['waeup.UsersManager'] 194 >>> browser.open('http://localhost/my institution/users')194 >>> browser.open('http://localhost/mycompany/users') 195 195 >>> print browser.contents 196 196 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... … … 200 200 Users can't be added twice: 201 201 202 >>> browser.open('http://localhost/my institution/users/add')202 >>> browser.open('http://localhost/mycompany/users/add') 203 203 >>> browser.getControl(name="form.name").value = 'bob' 204 204 >>> browser.getControl(name="form.title").value = 'Bob The User' … … 215 215 Users can be deleted: 216 216 217 >>> browser.open('http://localhost/my institution/users')217 >>> browser.open('http://localhost/mycompany/users') 218 218 >>> browser.getControl("Remove", index=0).click() 219 219 >>> 'User account bob successfully deleted' in browser.contents … … 227 227 Let's enter the contact form:: 228 228 229 >>> browser.open('http://localhost/my institution/contactadmin')229 >>> browser.open('http://localhost/mycompany/contactadmin') 230 230 >>> print browser.contents 231 231 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... … … 236 236 contact@waeup.org):: 237 237 238 >>> browser.open('http://localhost/my institution/contactadmin')238 >>> browser.open('http://localhost/mycompany/contactadmin') 239 239 >>> browser.getControl(name='form.body').value = "test message" 240 240 >>> browser.getControl('Send').click() … … 253 253 The data center helps us uploading files for later import or similar. 254 254 255 >>> browser.open('http://localhost/my institution')255 >>> browser.open('http://localhost/mycompany') 256 256 >>> browser.getLink('Data Center').click() 257 257
Note: See TracChangeset for help on using the changeset viewer.