source: main/waeup.sirp/branches/ulif-stress-multimech/multi-mechanize/projects/sirp1/test_scripts/get_application.py @ 7546

Last change on this file since 7546 was 7486, checked in by uli, 13 years ago

Using zope.testbrowser.

File size: 999 bytes
Line 
1import mechanize
2import time
3#from mechanize import Browser
4from zope.testbrowser.browser import Browser
5from helpers import BASE_URL
6
7class Transaction(object):
8    def __init__(self):
9        self.custom_timers = {}
10        self.base_url = BASE_URL + 'applicants'
11
12    def run(self):
13        browser = Browser()
14        #browser.set_handle_robots(False)
15
16
17        start_timer = time.time()
18        resp = browser.open(self.base_url)#'http://localhost:8080/app-stress/applicants')
19        #resp.read()
20        latency = time.time() - start_timer
21
22        self.custom_timers['SIRP Applicant Section'] = latency
23
24        #assert (resp.code == 200), 'Bad HTTP Response'
25        assert ('Application Section' in browser.contents),'Failed Content Verification'
26        time.sleep(2.0)
27        #assert (
28        #    'Application Section' in resp.get_data()
29        #    ),'Failed Content Verification'
30
31
32if __name__ == '__main__':
33    trans = Transaction()
34    trans.run()
35    print trans.custom_timers
Note: See TracBrowser for help on using the repository browser.