details: http://www.bx.psu.edu/hg/galaxy/rev/731875ce0a36 changeset: 2970:731875ce0a36 user: rc date: Thu Nov 05 14:19:45 2009 -0500 description: Refactored the new address functional test diffstat: lib/galaxy/web/controllers/user.py | 4 ++++ test/base/twilltestcase.py | 17 +++++++++++++++++ test/functional/test_forms_and_requests.py | 8 +------- 3 files changed, 22 insertions(+), 7 deletions(-) diffs (66 lines): diff -r c6a8bd78357a -r 731875ce0a36 lib/galaxy/web/controllers/user.py --- a/lib/galaxy/web/controllers/user.py Thu Nov 05 10:39:59 2009 -0500 +++ b/lib/galaxy/web/controllers/user.py Thu Nov 05 14:19:45 2009 -0500 @@ -680,6 +680,8 @@ widget=TextField( 'institution', 40, '' ) ) ) widgets.append(dict(label='Address Line 1', widget=TextField( 'address1', 40, '' ) ) ) + widgets.append(dict(label='Address Line 2', + widget=TextField( 'address2', 40, '' ) ) ) widgets.append(dict(label='City', widget=TextField( 'city', 40, '' ) ) ) widgets.append(dict(label='State', @@ -762,6 +764,8 @@ widget=TextField( 'institution', 40, user_address.institution ) ) ) widgets.append(dict(label='Address Line 1', widget=TextField( 'address1', 40, user_address.address ) ) ) + widgets.append(dict(label='Address Line 2', + widget=TextField( 'address2', 40, '' ) ) ) widgets.append(dict(label='City', widget=TextField( 'city', 40, user_address.city ) ) ) widgets.append(dict(label='State', diff -r c6a8bd78357a -r 731875ce0a36 test/base/twilltestcase.py --- a/test/base/twilltestcase.py Thu Nov 05 10:39:59 2009 -0500 +++ b/test/base/twilltestcase.py Thu Nov 05 14:19:45 2009 -0500 @@ -1281,6 +1281,23 @@ tc.fv( "1", "comment", comment ) tc.submit( "add_event_button" ) self.check_page_for_string( new_state_name ) + def add_user_address( self, user_id, address_dict ): + self.home() + self.visit_url( "%s/user/new_address?admin_view=False&user_id=%i" % ( self.url, user_id ) ) + self.check_page_for_string( 'New address' ) + for field_name, value in address_dict.items(): + tc.fv( "1", field_name, value ) + tc.submit( "save_new_address_button" ) + self.check_page_for_string( 'Address <b>%s</b> has been added' % address_dict[ 'short_desc' ] ) + def add_user_address_as_admin( self, user_id, address_dict ): + self.home() + self.visit_url( "%s/user/new_address?admin_view=True&user_id=%i" % ( self.url, user_id ) ) + self.check_page_for_string( 'New address' ) + for field_name, value in address_dict.items(): + tc.fv( "1", field_name, value ) + tc.submit( "save_new_address_button" ) + self.check_page_for_string( 'Address <b>%s</b> has been added' % address_dict[ 'short_desc' ] ) + # Library stuff def create_library( self, name='Library One', description='This is Library One' ): """Create a new library""" diff -r c6a8bd78357a -r 731875ce0a36 test/functional/test_forms_and_requests.py --- a/test/functional/test_forms_and_requests.py Thu Nov 05 10:39:59 2009 -0500 +++ b/test/functional/test_forms_and_requests.py Thu Nov 05 14:19:45 2009 -0500 @@ -168,13 +168,7 @@ # create address self.logout() self.login( email='test1@bx.psu.edu' ) - self.home() - url_str = '%s/user/new_address?short_desc=%s&name=%s&institution=%s&address1=%s&address2=%s&city=%s&state=%s&postal_code=%s&country=%s&phone=%s' \ - % ( self.url, address1[ 'short_desc' ], address1[ 'name' ], address1[ 'institution' ], - address1[ 'address1' ], address1[ 'address2' ], address1[ 'city' ], address1[ 'state' ], - address1[ 'postal_code' ], address1[ 'country' ], address1[ 'phone' ] ) - self.visit_url( url_str ) - self.check_page_for_string( 'Address <b>%s</b> has been added' % address1[ 'short_desc' ] ) + self.add_user_address( regular_user1.id, address1 ) global regular_user regular_user = sa_session.query( galaxy.model.User ) \ .filter( galaxy.model.User.table.c.email=='test1@bx.psu.edu' ) \