def test_035_edit_contents_of_ldda1_tempplate(self):
     """Testing editing the contents of ldda1 AddressField template by adding a new user_address"""
     short_desc = 'Home'
     # Now add a new user_address to ldda1
     self.ldda_edit_info(
         'library_admin',
         self.security.encode_id(library1.id),
         self.security.encode_id(folder1.id),
         self.security.encode_id(ldda1.id),
         ldda1.name,
         template_refresh_field_name=address_field_name,
         template_refresh_field_contents='new',
         template_fields=[
             ('%s_short_desc' % address_field_name, short_desc),
             ('%s_name' % address_field_name, 'Richard'),
             ('%s_institution' % address_field_name, 'PSU'),
             ('%s_address' % address_field_name, '32 O Street'),
             ('%s_city' % address_field_name, 'Anywhere'),
             ('%s_state' % address_field_name, 'AK'),
             ('%s_postal_code' % address_field_name, '0000000'),
             ('%s_country' % address_field_name, 'USA')
         ],
         strings_displayed=[short_desc])
     global user_address2
     user_address2 = get_user_address(admin_user, short_desc)
     assert user_address2 is not None, 'Problem retrieving user_address2 from the database'
 def test_030_add_dataset_to_folder1(self):
     """Testing adding a ldda1 to folder1, and adding a new UserAddress on the upload form."""
     # Logged in as admin_user
     # The AddressField template should be inherited to the library dataset upload form.  Passing
     # the value 'new' should submit the form via refresh_on_change and allow new UserAddress information
     # to be posted as part of the upload.
     filename = '1.bed'
     ldda_message = '1.bed message'
     short_desc = 'Office'
     self.upload_library_dataset(
         cntrller='library_admin',
         library_id=self.security.encode_id(library1.id),
         folder_id=self.security.encode_id(folder1.id),
         filename=filename,
         file_type='bed',
         dbkey='hg18',
         template_refresh_field_name=address_field_name,
         ldda_message=ldda_message,
         template_refresh_field_contents='new',
         template_fields=[
             ('%s_short_desc' % address_field_name, short_desc),
             ('%s_name' % address_field_name, 'Dick'),
             ('%s_institution' % address_field_name, 'PSU'),
             ('%s_address' % address_field_name, '32 O Street'),
             ('%s_city' % address_field_name, 'Anywhere'),
             ('%s_state' % address_field_name, 'AK'),
             ('%s_postal_code' % address_field_name, '0000000'),
             ('%s_country' % address_field_name, 'USA')
         ],
         strings_displayed=['Upload files'])
     global user_address1
     user_address1 = get_user_address(admin_user, short_desc)
     assert user_address1 is not None, 'Problem retrieving user_address1 from the database'
     global ldda1
     ldda1 = get_latest_ldda_by_name(filename)
     assert ldda1 is not None, 'Problem retrieving LibraryDatasetDatasetAssociation ldda1 from the database'
     self.browse_library(
         cntrller='library_admin',
         library_id=self.security.encode_id(library1.id),
         strings_displayed=[ldda1.name, ldda1.message, 'bed'])
     # Make sure the library template contents were correctly saved
     self.ldda_edit_info('library_admin',
                         self.security.encode_id(library1.id),
                         self.security.encode_id(folder1.id),
                         self.security.encode_id(ldda1.id),
                         ldda1.name,
                         strings_displayed=['Dick'])
 def test_030_add_dataset_to_folder1( self ):
     """Testing adding a ldda1 to folder1, and adding a new UserAddress on the upload form."""
     # Logged in as admin_user
     # The AddressField template should be inherited to the library dataset upload form.  Passing
     # the value 'new' should submit the form via refresh_on_change and allow new UserAddress information
     # to be posted as part of the upload.
     filename = '1.bed'
     ldda_message = '1.bed message'
     short_desc = 'Office'
     self.upload_library_dataset( cntrller='library_admin',
                                  library_id=self.security.encode_id( library1.id ),
                                  folder_id=self.security.encode_id( folder1.id ),
                                  filename=filename,
                                  file_type='bed',
                                  dbkey='hg18',
                                  template_refresh_field_name=address_field_name,
                                  ldda_message=ldda_message,
                                  template_refresh_field_contents='new',
                                  template_fields=[ ( '%s_short_desc' % address_field_name, short_desc ),
                                                    ( '%s_name' % address_field_name, 'Dick' ),
                                                    ( '%s_institution' % address_field_name, 'PSU' ),
                                                    ( '%s_address' % address_field_name, '32 O Street' ),
                                                    ( '%s_city' % address_field_name, 'Anywhere' ),
                                                    ( '%s_state' % address_field_name, 'AK' ),
                                                    ( '%s_postal_code' % address_field_name, '0000000' ),
                                                    ( '%s_country' % address_field_name, 'USA' ) ],
                                  strings_displayed=[ 'Upload files' ] )
     global user_address1
     user_address1 = get_user_address( admin_user, short_desc )
     assert user_address1 is not None, 'Problem retrieving user_address1 from the database'
     global ldda1
     ldda1 = get_latest_ldda_by_name( filename )
     assert ldda1 is not None, 'Problem retrieving LibraryDatasetDatasetAssociation ldda1 from the database'
     self.browse_library( cntrller='library_admin',
                          library_id=self.security.encode_id( library1.id ),
                          strings_displayed=[ ldda1.name, ldda1.message, 'bed' ] )
     # Make sure the library template contents were correctly saved
     self.ldda_edit_info( 'library_admin',
                          self.security.encode_id( library1.id ),
                          self.security.encode_id( folder1.id ),
                          self.security.encode_id( ldda1.id ),
                          ldda1.name,
                          strings_displayed=[ 'Dick' ] )
 def test_035_edit_contents_of_ldda1_tempplate( self ):
     """Testing editing the contents of ldda1 AddressField template by adding a new user_address"""
     short_desc = 'Home'
     # Now add a new user_address to ldda1
     self.ldda_edit_info( 'library_admin',
                          self.security.encode_id( library1.id ),
                          self.security.encode_id( folder1.id ),
                          self.security.encode_id( ldda1.id ),
                          ldda1.name,
                          template_refresh_field_name=address_field_name,
                          template_refresh_field_contents='new',
                          template_fields=[ ( '%s_short_desc' % address_field_name, short_desc ),
                                            ( '%s_name' % address_field_name, 'Richard' ),
                                            ( '%s_institution' % address_field_name, 'PSU' ),
                                            ( '%s_address' % address_field_name, '32 O Street' ),
                                            ( '%s_city' % address_field_name, 'Anywhere' ),
                                            ( '%s_state' % address_field_name, 'AK' ),
                                            ( '%s_postal_code' % address_field_name, '0000000' ),
                                            ( '%s_country' % address_field_name, 'USA' ) ],
                          strings_displayed=[ short_desc ] )
     global user_address2
     user_address2 = get_user_address( admin_user, short_desc )
     assert user_address2 is not None, 'Problem retrieving user_address2 from the database'