def test_article_in_unreleased_issue(self):
        """webjournal - check access to unreleased article"""

        # Record is not public
        self.assertEqual(record_public_p(112), False)

        # Unreleased article is not visible to guest
        error_messages = test_web_page_content(
            CFG_SITE_URL + "/journal/AtlantisTimes/2009/06/News/112",
            expected_text=["A naturalist's voyage around the world"],
            unexpected_text=["Galapagos Archipelago"],
        )
        if error_messages:
            self.fail(merge_error_messages(error_messages))

        # Unreleased article is visible to editor
        error_messages = test_web_page_content(
            CFG_SITE_URL + "/journal/AtlantisTimes/2009/06/News/112",
            username="******",
            password="******",
            expected_text=["Galapagos Archipelago"],
            unexpected_text=["This file is restricted", "You are not authorized"],
        )
        if error_messages:
            self.fail(merge_error_messages(error_messages))
 def test_robot_login_method_merging_accounts(self):
     """webaccess - robot login method merging accounts"""
     for method_name, method in self.robot_login_methods.iteritems():
         url = method.test_create_example_url(self.a_email, method_name, self.a_robot, self.myip, nickname=self.a_nickname)
         url2 = method.test_create_example_url(self.another_email, method_name, self.a_robot, self.myip, nickname=self.another_nickname)
         url3 = method.test_create_example_url(self.a_email, method_name, self.a_robot, self.myip, nickname=self.another_nickname)
         try:
             error_messages = test_web_page_content(url, expected_text=self.a_nickname)
             if error_messages:
                 self.fail(merge_error_messages(error_messages))
             id_user = run_sql("SELECT id FROM user WHERE email=%s", (self.a_email, ))[0][0]
             self.failUnless(run_sql("SELECT * FROM userEXT WHERE id=%s AND id_user=%s AND method=%s", (self.a_nickname, id_user, method_name)))
             error_messages = test_web_page_content(url2, expected_text=self.another_nickname)
             if error_messages:
                 self.fail(merge_error_messages(error_messages))
             id_user2 = run_sql("SELECT id FROM user WHERE email=%s", (self.another_email, ))[0][0]
             self.failIfEqual(id_user, id_user2)
             self.failUnless(run_sql("SELECT * FROM userEXT WHERE id=%s AND id_user=%s AND method=%s", (self.another_nickname, id_user2, method_name)), "Can't find id %s for user %s with metod %s. userEXT contains: %s" % (self.another_nickname, id_user2, method_name, run_sql("SELECT * FROM userEXT")))
             ## The first email should still exists
             self.failUnless(run_sql("SELECT * FROM user WHERE email=%s", (self.a_email, )))
             ## We log in with the 1st email but with the second nickname.
             ## That means the 1st user should be merged into the second.
             error_messages = test_web_page_content(url3, expected_text=self.another_nickname)
             if error_messages:
                 self.fail(merge_error_messages(error_messages))
             ## The another_email should not exist any longer.
             self.failIf(run_sql("SELECT * FROM user WHERE email=%s", (self.another_email, )), "%s still exists! while it should have been merged into %s: %s, userEXT contains: %s" % (self.another_email, self.a_email, run_sql("SELECT * FROM user WHERE email=%s", (self.another_email, )), run_sql("SELECT * FROM userEXT")))
             ## And the corresponding user should not exist anymore as it has been
             ## merged into id_user
             self.failIf(run_sql("SELECT * FROM user WHERE id=%s", (id_user2, )))
             self.failUnless(run_sql("SELECT * FROM user WHERE id=%s AND email=%s", (id_user, self.a_email)))
         finally:
             self._erase_example_user_and_groups()
    def test_article_in_unreleased_issue(self):
        """webjournal - check access to unreleased article"""

        # Record is not public
        self.assertEqual(record_public_p(112), False)

        # Unreleased article is not visible to guest
        error_messages = test_web_page_content(
            CFG_SITE_URL + '/journal/AtlantisTimes/2009/06/News/112',
            expected_text=["A naturalist's voyage around the world"],
            unexpected_text=['Galapagos Archipelago'])
        if error_messages:
            self.fail(merge_error_messages(error_messages))

        # Unreleased article is visible to editor
        error_messages = test_web_page_content(
            CFG_SITE_URL + '/journal/AtlantisTimes/2009/06/News/112',
            username='******',
            password='******',
            expected_text=['Galapagos Archipelago'],
            unexpected_text=[
                'This file is restricted', 'You are not authorized'
            ])
        if error_messages:
            self.fail(merge_error_messages(error_messages))
Example #4
0
    def test_websearch_admin_interface_pages_availability(self):
        """websearchadmin - availability of WebSearch Admin interface pages"""

        baseurl = CFG_SITE_URL + '/admin/websearch/websearchadmin.py'

        _exports = [
            '',
            '?mtype=perform_showall',
            '?mtype=perform_addcollection',
            '?mtype=perform_addcollectiontotree',
            '?mtype=perform_modifycollectiontree',
            '?mtype=perform_checkwebcollstatus',
            '?mtype=perform_checkcollectionstatus',
        ]

        error_messages = []
        for url in [baseurl + page for page in _exports]:
            # first try as guest:
            error_messages.extend(
                test_web_page_content(url,
                                      username='******',
                                      expected_text='Authorization failure'))
            # then try as admin:
            error_messages.extend(test_web_page_content(url, username='******'))
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
Example #5
0
 def test_language_handling_in_whatsnew_widget(self):
     """webjournal - check handling of ln parameter in "what's new" widget"""
     error_messages = test_web_page_content(CFG_SITE_URL + '/journal/AtlantisTimes/2009/03/News?ln=fr' ,
                                            expected_link_label="Scissor-beak",
                                            expected_link_target=CFG_SITE_URL + "/journal/AtlantisTimes/2009/03/Science/111?ln=fr")
     if error_messages:
         self.fail(merge_error_messages(error_messages))
 def test_language_handling_in_whatsnew_widget(self):
     """webjournal - check handling of ln parameter in "what's new" widget"""
     error_messages = test_web_page_content(CFG_SITE_URL + '/journal/AtlantisTimes/2009/03/News?ln=fr' ,
                                            expected_link_label="Scissor-beak",
                                            expected_link_target=CFG_SITE_URL + "/journal/AtlantisTimes/2009/03/Science/111?ln=fr")
     if error_messages:
         self.fail(merge_error_messages(error_messages))
    def test_bibindex_admin_interface_pages_availability(self):
        """bibindexadmin - availability of BibIndex Admin interface pages"""

        baseurl = CFG_SITE_URL + '/admin/bibindex/bibindexadmin.py/'

        _exports = ['',
                    'index',
                    'index?mtype=perform_showindexoverview',
                    'index?mtype=perform_editindexes',
                    'index?mtype=perform_addindex',
                    'field',
                    'field?mtype=perform_showfieldoverview',
                    'field?mtype=perform_editfields',
                    'field?mtype=perform_addfield',
                    ]

        error_messages = []
        for url in [baseurl + page for page in _exports]:
            # first try as guest:
            error_messages.extend(test_web_page_content(url,
                                                        username='******',
                                                        expected_text=
                                                        'Authorization failure'))
            # then try as admin:
            error_messages.extend(test_web_page_content(url,
                                                        username='******'))
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
    def test_your_account_pages_availability(self):
        """websession - availability of Your Account pages"""

        baseurl = CFG_SITE_SECURE_URL + "/youraccount/"

        _exports = [
            "",
            "edit",
            "change",
            "lost",
            "display",
            "send_email",
            "youradminactivities",
            "delete",
            "logout",
            "login",
            "register",
        ]

        error_messages = []
        for url in [baseurl + page for page in _exports]:
            error_messages.extend(test_web_page_content(url))
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
    def test_oai_server_pages_availability(self):
        """oairepository - availability of OAI server pages"""

        baseurl = CFG_SITE_URL + '/oai2d'

        _exports = [#fast commands first:
                    '?verb=Identify',
                    '?verb=ListMetadataFormats',
                    # sleepy commands now:
                    '?verb=ListSets',
                    '?verb=ListRecords',
                    '?verb=GetRecord']

        error_messages = []
        for url in [baseurl + page for page in _exports]:
            if url.endswith('Identify') or \
               url.endswith('ListMetadataFormats'):
                pass
            else:
                # some sleep required for verbs other than Identify
                # and ListMetadataFormats, since oai2d refuses too
                # frequent access:
                time.sleep(CFG_OAI_SLEEP)
            error_messages.extend(test_web_page_content(url,
                                                        expected_text=
                                                        '</OAI-PMH>'))
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
Example #10
0
    def test_precached_area_authorization(self):
        """webaccess - login-time precached authorizations for usebaskets"""
        error_messages = test_web_page_content(CFG_SITE_SECURE_URL + '/youraccount/display?ln=en', username='******', password='******', expected_text='Your Baskets')
        error_messages.extend(test_web_page_content(CFG_SITE_SECURE_URL + '/youraccount/display?ln=en', username='******', password='******', unexpected_text='Your Baskets'))

        if error_messages:
            self.fail(merge_error_messages(error_messages))
    def test_precached_area_authorization(self):
        """webaccess - login-time precached authorizations for usebaskets"""
        error_messages = test_web_page_content(CFG_SITE_SECURE_URL + '/youraccount/display?ln=en', username='******', password='******', expected_text='Your Baskets')
        error_messages.extend(test_web_page_content(CFG_SITE_SECURE_URL + '/youraccount/display?ln=en', username='******', password='******', unexpected_text='Your Baskets'))

        if error_messages:
            self.fail(merge_error_messages(error_messages))
 def test_robot_login_method_with_invalid_signature(self):
     """webaccess - robot login method with invalid signature"""
     for method_name, method in self.robot_login_methods.iteritems():
         url = method.test_create_example_url(self.a_email, method_name,
                                              self.a_robot, self.myip)
         url = list(urlparse(url))
         query = cgi.parse_qs(url[4])
         for key, value in query.items():
             query[key] = value[0]
         digest = query['digest']
         digest0 = digest[0]
         if digest0 == '0':
             digest0 = '1'
         else:
             digest0 = '0'
         digest = digest0 + digest[1:]
         query['digest'] = digest
         url[4] = urlencode(query)
         url = urlunparse(url)
         try:
             error_messages = test_web_page_content(
                 url,
                 expected_text="does not validate against the digest")
             if error_messages:
                 self.fail(merge_error_messages(error_messages))
         finally:
             self._erase_example_user_and_groups()
Example #13
0
    def test_oai_server_pages_availability(self):
        """oairepository - availability of OAI server pages"""

        baseurl = CFG_SITE_URL + '/oai2d'

        _exports = [  #fast commands first:
            '?verb=Identify',
            '?verb=ListMetadataFormats',
            # sleepy commands now:
            '?verb=ListSets',
            '?verb=ListRecords',
            '?verb=GetRecord'
        ]

        error_messages = []
        for url in [baseurl + page for page in _exports]:
            if url.endswith('Identify') or \
               url.endswith('ListMetadataFormats'):
                pass
            else:
                # some sleep required for verbs other than Identify
                # and ListMetadataFormats, since oai2d refuses too
                # frequent access:
                time.sleep(CFG_OAI_SLEEP)
            error_messages.extend(
                test_web_page_content(url, expected_text='</OAI-PMH>'))
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
    def test_bibindex_admin_interface_pages_availability(self):
        """bibindexadmin - availability of BibIndex Admin interface pages"""

        baseurl = CFG_SITE_URL + '/admin/bibindex/bibindexadmin.py/'

        _exports = [
            '', 'index', 'index?mtype=perform_showindexoverview',
            'index?mtype=perform_showvirtualindexoverview',
            'index?mtype=perform_editindexes', 'index?mtype=perform_addindex',
            'index?mtype=perform_editvirtualindex',
            'index?mtype=perform_addvirtualindex', 'field',
            'field?mtype=perform_showfieldoverview',
            'field?mtype=perform_editfields', 'field?mtype=perform_addfield',
            'editindex?mtype=perform_modifysynonymkb',
            'editindex?mtype=perform_modifystopwords',
            'editindex?mtype=perform_modifyremovehtml',
            'editindex?mtype=perform_modifyremovelatex',
            'editindex?mtype=perform_modifytokenizer'
        ]

        error_messages = []
        for url in [baseurl + page for page in _exports]:
            # first try as guest:
            error_messages.extend(
                test_web_page_content(url,
                                      username='******',
                                      expected_text='Authorization failure'))
            # then try as admin:
            error_messages.extend(test_web_page_content(url, username='******'))
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
Example #15
0
 def test_web_search_restricted_collection_as_guest(self):
     """websearch - search for restricted collection as guest, from search page"""
     url = CFG_SITE_SECURE_URL + '/search?p=Theses&ln=en'
     error_messages = test_web_page_content(
         url, unexpected_text=['Looking for a particular collection?'])
     if error_messages:
         self.fail(merge_error_messages(error_messages))
    def test_websearch_admin_interface_pages_availability(self):
        """websearchadmin - availability of WebSearch Admin interface pages"""

        baseurl = CFG_SITE_URL + '/admin/websearch/websearchadmin.py'

        _exports = ['',
                    '?mtype=perform_showall',
                    '?mtype=perform_addcollection',
                    '?mtype=perform_addcollectiontotree',
                    '?mtype=perform_modifycollectiontree',
                    '?mtype=perform_checkwebcollstatus',
                    '?mtype=perform_checkcollectionstatus',]

        error_messages = []
        for url in [baseurl + page for page in _exports]:
            # first try as guest:
            error_messages.extend(test_web_page_content(url,
                                                        username='******',
                                                        expected_text=
                                                        'Authorization failure'))
            # then try as admin:
            error_messages.extend(test_web_page_content(url,
                                                        username='******'))
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
 def test_web_search_restricted_collection_as_guest(self):
     """websearch - search for restricted collection as guest, from search page"""
     url = CFG_SITE_SECURE_URL + '/search?p=Theses&ln=en'
     error_messages = test_web_page_content(url,
                                            unexpected_text=['Looking for a particular collection?'])
     if error_messages:
         self.fail(merge_error_messages(error_messages))
    def test_bibformat_admin_guide_availability(self):
        """bibformatadmin - availability of BibFormat Admin guide pages"""

        url = CFG_SITE_URL + "/help/admin/bibformat-admin-guide"
        error_messages = test_web_page_content(url, expected_text="BibFormat Admin Guide")
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
 def test_language_handling_in_record(self):
     """webjournal - check washing of ln parameter in /record handler"""
     error_messages = test_web_page_content(CFG_SITE_URL + '/record/103?verbose=9&ln=hello' ,
                                            expected_text=["we rode to another estate",
                                                           "The forest abounded with beautiful objects"],
                                            unexpected_text=["Error when evaluating format element WEBJOURNAL_"])
     if error_messages:
         self.fail(merge_error_messages(error_messages))
    def test_webaccess_admin_guide_availability(self):
        """webaccess - availability of WebAccess Admin guide pages"""

        url = CFG_SITE_URL + "/help/admin/webaccess-admin-guide"
        error_messages = test_web_page_content(url, expected_text="WebAccess Admin Guide")
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
 def test_web_search_restricted_submission_as_guest(self):
     """websearch - search for restricted submission as guest, from search page"""
     url = CFG_SITE_SECURE_URL + '/search?p=submit%20thesis&ln=en'
     error_messages = test_web_page_content(url,
                                            unexpected_text=['Demo Thesis Submission',
                                                             'Looking for a particular submission?'])
     if error_messages:
         self.fail(merge_error_messages(error_messages))
Example #22
0
 def test_oairepositoryadmin_delete_set(self):
     """oairepositoryadmin - delete set page"""
     test_edit_url = CFG_SITE_URL + \
            "/admin/oairepository/oairepositoryadmin.py/delset?oai_set_id=2"
     error_messages = test_web_page_content(test_edit_url, username='******')
     if error_messages:
         self.fail(merge_error_messages(error_messages))
     return
    def test_oai_admin_guide_availability(self):
        """oaiharvestadmin - availability of OAI Admin Guide"""

        url = CFG_SITE_URL + "/help/admin/oai-admin-guide"
        error_messages = test_web_page_content(url, expected_text="OAI Admin Guide")
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
Example #24
0
 def test_language_handling_in_record(self):
     """webjournal - check washing of ln parameter in /record handler"""
     error_messages = test_web_page_content(CFG_SITE_URL + '/record/103?verbose=9&ln=hello' ,
                                            expected_text=["we rode to another estate",
                                                           "The forest abounded with beautiful objects"],
                                            unexpected_text=["Error when evaluating format element WEBJOURNAL_"])
     if error_messages:
         self.fail(merge_error_messages(error_messages))
    def test_bibedit_admin_guide_availability(self):
        """bibedit - availability of BibEdit Admin guide pages"""

        url = CFG_SITE_URL + '/help/admin/bibedit-admin-guide'
        error_messages = test_web_page_content(
            url, expected_text="BibEdit Admin Guide")
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
    def test_bibindex_admin_guide_availability(self):
        """bibindexadmin - availability of BibIndex Admin guide pages"""

        url = CFG_SITE_URL + '/help/admin/bibindex-admin-guide'
        error_messages = test_web_page_content(url,
                                               expected_text="BibIndex Admin Guide")
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
 def test_web_search_public_submission_as_guest(self):
     """websearch - search for public submission as guest, from search page"""
     url = CFG_SITE_SECURE_URL + '/search?p=submit%20article&ln=en'
     error_messages = test_web_page_content(url,
                                            expected_text='Looking for a particular submission?',
                                            expected_link_label='Demo Article Submission',
                                            expected_link_target=CFG_SITE_SECURE_URL + '/submit?doctype=DEMOART&ln=en')
     if error_messages:
         self.fail(merge_error_messages(error_messages))
Example #28
0
    def test_oai_admin_guide_availability(self):
        """oaiharvestadmin - availability of OAI Admin Guide"""

        url = CFG_SITE_URL + '/help/admin/oai-admin-guide'
        error_messages = test_web_page_content(url,
                                               expected_text="OAI Admin Guide")
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
 def test_web_search_restricted_submission_as_guest(self):
     """websearch - search for restricted submission as guest, from search page"""
     url = CFG_SITE_SECURE_URL + '/search?p=submit%20thesis&ln=en'
     error_messages = test_web_page_content(url,
                                            unexpected_text=[
                                                'Demo Thesis Submission',
                                                'Looking for a particular submission?'])
     if error_messages:
         self.fail(merge_error_messages(error_messages))
 def test_web_search_public_collection_as_guest(self):
     """websearch - search for public collection as guest, with CollectionNameSearchService"""
     url = CFG_SITE_SECURE_URL + '/search?p=Atlantis%20Times%20Arts&ln=en'
     error_messages = test_web_page_content(url,
                                            expected_text='Looking for a particular collection?',
                                            expected_link_label='Atlantis Times Arts',
                                            expected_link_target=CFG_SITE_SECURE_URL + '/collection/Atlantis%20Times%20Arts?ln=en')
     if error_messages:
         self.fail(merge_error_messages(error_messages))
Example #31
0
    def test_websearch_admin_guide_availability(self):
        """websearchadmin - availability of WebSearch Admin guide pages"""

        url = CFG_SITE_URL + '/help/admin/websearch-admin-guide'
        error_messages = test_web_page_content(
            url, expected_text="WebSearch Admin Guide")
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
 def test_oairepositoryadmin_delete_set(self):
     """oairepositoryadmin - delete set page"""
     test_edit_url = CFG_SITE_URL + \
            "/admin/bibharvest/oairepositoryadmin.py/delset?oai_set_id=2"
     error_messages = test_web_page_content(test_edit_url,
                                            username='******')
     if error_messages:
         self.fail(merge_error_messages(error_messages))
     return
    def test_websearch_admin_guide_availability(self):
        """websearchadmin - availability of WebSearch Admin guide pages"""

        url = CFG_SITE_URL + '/help/admin/websearch-admin-guide'
        error_messages = test_web_page_content(url,
                                               expected_text="WebSearch Admin Guide")
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
 def test_web_search_public_submission_as_guest(self):
     """websearch - search for public submission as guest, from search page"""
     url = CFG_SITE_SECURE_URL + '/search?p=submit%20article&ln=en'
     error_messages = test_web_page_content(url,
                                            expected_text='Looking for a particular submission?',
                                            expected_link_label='Demo Article Submission',
                                            expected_link_target=CFG_SITE_SECURE_URL + '/submit?doctype=DEMOART&ln=en')
     if error_messages:
         self.fail(merge_error_messages(error_messages))
 def test_web_search_public_collection_as_guest(self):
     """websearch - search for public collection as guest, with CollectionNameSearchService"""
     url = CFG_SITE_SECURE_URL + '/search?p=Atlantis%20Times%20Arts&ln=en'
     error_messages = test_web_page_content(url,
                                            expected_text='Looking for a particular collection?',
                                            expected_link_label='Atlantis Times Arts',
                                            expected_link_target=CFG_SITE_SECURE_URL + '/collection/Atlantis%20Times%20Arts?ln=en')
     if error_messages:
         self.fail(merge_error_messages(error_messages))
 def test_robot_login_method_changed_email(self):
     """webaccess - robot login method changed email"""
     for method_name, method in self.robot_login_methods.iteritems():
         url = method.test_create_example_url(self.a_email,
                                              method_name,
                                              self.a_robot,
                                              self.myip,
                                              nickname=self.a_nickname)
         url2 = method.test_create_example_url(self.another_email,
                                               method_name,
                                               self.a_robot,
                                               self.myip,
                                               nickname=self.a_nickname)
         try:
             error_messages = test_web_page_content(
                 url, expected_text=self.a_nickname)
             if error_messages:
                 self.fail(merge_error_messages(error_messages))
             id_user = run_sql("SELECT id FROM user WHERE email=%s",
                               (self.a_email, ))[0][0]
             self.failUnless(
                 run_sql(
                     "SELECT * FROM userEXT WHERE id=%s AND id_user=%s AND method=%s",
                     (self.a_nickname, id_user, method_name)),
                 "Can't find id %s for user %s with metod %s. userEXT contains: %s"
                 % (self.a_nickname, id_user, method_name,
                    run_sql("SELECT * FROM userEXT")))
             error_messages = test_web_page_content(
                 url2, expected_text=self.a_nickname)
             if error_messages:
                 self.fail(merge_error_messages(error_messages))
             id_user2 = run_sql("SELECT id FROM user WHERE email=%s",
                                (self.another_email, ))[0][0]
             self.assertEqual(id_user, id_user2)
             self.failUnless(
                 run_sql(
                     "SELECT * FROM userEXT WHERE id=%s AND id_user=%s AND method=%s",
                     (self.a_nickname, id_user2, method_name)))
             ## The old email should not exist any longer.
             self.failIf(
                 run_sql("SELECT * FROM user WHERE email=%s",
                         (self.a_email, )))
         finally:
             self._erase_example_user_and_groups()
Example #37
0
 def test_robot_login_method_wrong_ip(self):
     """webaccess - robot login method wrong IP"""
     for method_name, method in self.robot_login_methods.iteritems():
         url = method.test_create_example_url(self.a_email, method_name, self.a_robot, '123.123.123.123')
         try:
             error_messages = test_web_page_content(url, expected_text="The provided assertion has been issued for a different IP address")
             if error_messages:
                 self.fail(merge_error_messages(error_messages))
         finally:
             self._erase_example_user_and_groups()
 def test_robot_login_method_wrong_ip(self):
     """webaccess - robot login method wrong IP"""
     for method_name, method in self.robot_login_methods.iteritems():
         url = method.test_create_example_url(self.a_email, method_name, self.a_robot, '123.123.123.123')
         try:
             error_messages = test_web_page_content(url, expected_text="The provided assertion has been issued for a different IP address")
             if error_messages:
                 self.fail(merge_error_messages(error_messages))
         finally:
             self._erase_example_user_and_groups()
 def test_normal_robot_login_method(self):
     """webaccess - robot login method"""
     for method_name, method in self.robot_login_methods.iteritems():
         url = method.test_create_example_url(self.a_email, method_name, self.a_robot, self.myip)
         try:
             error_messages = test_web_page_content(url, expected_text=self.a_email)
             if error_messages:
                 self.fail(merge_error_messages(error_messages))
         finally:
             self._erase_example_user_and_groups()
Example #40
0
 def test_normal_robot_login_method(self):
     """webaccess - robot login method"""
     for method_name, method in self.robot_login_methods.iteritems():
         url = method.test_create_example_url(self.a_email, method_name, self.a_robot, self.myip)
         try:
             error_messages = test_web_page_content(url, expected_text=self.a_email)
             if error_messages:
                 self.fail(merge_error_messages(error_messages))
         finally:
             self._erase_example_user_and_groups()
Example #41
0
 def test_robot_login_method_with_groups(self):
     """webaccess - robot login method with groups"""
     for method_name, method in self.robot_login_methods.iteritems():
         url = method.test_create_example_url(self.a_email, method_name, self.a_robot, self.myip, groups=self.some_groups, referer=CFG_SITE_SECURE_URL + "/yourgroups/display")
         try:
             for group in self.some_groups:
                 error_messages = test_web_page_content(url, expected_text="%s [%s]" % (group, method_name))
             if error_messages:
                 self.fail(merge_error_messages(error_messages))
         finally:
             self._erase_example_user_and_groups()
 def test_web_search_restricted_submission_category(self):
     """websearch - search for restricted submission, from search page"""
     url = CFG_SITE_SECURE_URL + '/search?p=submit%20news&ln=en'
     error_messages = test_web_page_content(url,
                                            username='******',
                                            password='******',
                                            expected_text='Looking for a particular submission?',
                                            expected_link_label='News (Demo Journal Submission)',
                                            expected_link_target=CFG_SITE_SECURE_URL + '/submit?doctype=DEMOJRN&ln=en')
     if error_messages:
         self.fail(merge_error_messages(error_messages))
 def test_web_search_restricted_collection(self):
     """websearch - search for restricted collection, from search page"""
     url = CFG_SITE_SECURE_URL + '/search?p=Theses&ln=en'
     error_messages = test_web_page_content(url,
                                            username='******',
                                            password='******',
                                            expected_text='Looking for a particular collection?',
                                            expected_link_label='Theses',
                                            expected_link_target=CFG_SITE_SECURE_URL + '/collection/Theses?ln=en')
     if error_messages:
         self.fail(merge_error_messages(error_messages))
 def test_web_search_restricted_collection(self):
     """websearch - search for restricted collection, from search page"""
     url = CFG_SITE_SECURE_URL + '/search?p=Theses&ln=en'
     error_messages = test_web_page_content(url,
                                            username='******',
                                            password='******',
                                            expected_text='Looking for a particular collection?',
                                            expected_link_label='Theses',
                                            expected_link_target=CFG_SITE_SECURE_URL + '/collection/Theses?ln=en')
     if error_messages:
         self.fail(merge_error_messages(error_messages))
 def test_web_search_restricted_submission_category(self):
     """websearch - search for restricted submission, from search page"""
     url = CFG_SITE_SECURE_URL + '/search?p=submit%20news&ln=en'
     error_messages = test_web_page_content(url,
                                            username='******',
                                            password='******',
                                            expected_text='Looking for a particular submission?',
                                            expected_link_label='News (Demo Journal Submission)',
                                            expected_link_target=CFG_SITE_SECURE_URL + '/submit?doctype=DEMOJRN&ln=en')
     if error_messages:
         self.fail(merge_error_messages(error_messages))
 def test_robot_login_method_expired_assertion(self):
     """webaccess - robot login method with expired assertion"""
     for method_name, method in self.robot_login_methods.iteritems():
         url = method.test_create_example_url(self.a_email, method_name, self.a_robot, self.myip, timeout=time.time())
         time.sleep(1)
         try:
             error_messages = test_web_page_content(url, expected_text="The provided assertion is expired")
             if error_messages:
                 self.fail(merge_error_messages(error_messages))
         finally:
             self._erase_example_user_and_groups()
Example #47
0
 def test_robot_login_method_with_nickname(self):
     """webaccess - robot login method with nickname"""
     for method_name, method in self.robot_login_methods.iteritems():
         if method.enforce_external_nicknames:
             url = method.test_create_example_url(self.a_email, method_name, self.a_robot, self.myip, nickname=self.a_nickname)
             try:
                 error_messages = test_web_page_content(url, expected_text=self.a_nickname)
                 if error_messages:
                     self.fail(merge_error_messages(error_messages))
             finally:
                 self._erase_example_user_and_groups()
Example #48
0
 def test_robot_login_method_expired_assertion(self):
     """webaccess - robot login method with expired assertion"""
     for method_name, method in self.robot_login_methods.iteritems():
         url = method.test_create_example_url(self.a_email, method_name, self.a_robot, self.myip, timeout=time.time())
         time.sleep(1)
         try:
             error_messages = test_web_page_content(url, expected_text="The provided assertion is expired")
             if error_messages:
                 self.fail(merge_error_messages(error_messages))
         finally:
             self._erase_example_user_and_groups()
 def test_web_search_restricted_submission(self):
     """websearch - search for restricted submission, from search page"""
     url = CFG_SITE_SECURE_URL + '/search?p=submit%20thesis&ln=en'
     error_messages = test_web_page_content(url,
                                            username='******',
                                            password='******',
                                            expected_text='Looking for a particular submission?',
                                            expected_link_label='Demo Thesis Submission',
                                            expected_link_target=CFG_SITE_SECURE_URL + '/submit?doctype=DEMOTHE&ln=en')
     if error_messages:
         self.fail(merge_error_messages(error_messages))
 def test_web_search_restricted_submission(self):
     """websearch - search for restricted submission, from search page"""
     url = CFG_SITE_SECURE_URL + '/search?p=submit%20thesis&ln=en'
     error_messages = test_web_page_content(url,
                                            username='******',
                                            password='******',
                                            expected_text='Looking for a particular submission?',
                                            expected_link_label='Demo Thesis Submission',
                                            expected_link_target=CFG_SITE_SECURE_URL + '/submit?doctype=DEMOTHE&ln=en')
     if error_messages:
         self.fail(merge_error_messages(error_messages))
 def test_robot_login_method_with_groups(self):
     """webaccess - robot login method with groups"""
     for method_name, method in self.robot_login_methods.iteritems():
         url = method.test_create_example_url(self.a_email, method_name, self.a_robot, self.myip, groups=self.some_groups, referer=CFG_SITE_SECURE_URL + "/yourgroups/display")
         try:
             for group in self.some_groups:
                 error_messages = test_web_page_content(url, expected_text="%s [%s]" % (group, method_name))
             if error_messages:
                 self.fail(merge_error_messages(error_messages))
         finally:
             self._erase_example_user_and_groups()
 def test_robot_login_method_with_nickname(self):
     """webaccess - robot login method with nickname"""
     for method_name, method in self.robot_login_methods.iteritems():
         if method.enforce_external_nicknames:
             url = method.test_create_example_url(self.a_email, method_name, self.a_robot, self.myip, nickname=self.a_nickname)
             try:
                 error_messages = test_web_page_content(url, expected_text=self.a_nickname)
                 if error_messages:
                     self.fail(merge_error_messages(error_messages))
             finally:
                 self._erase_example_user_and_groups()
Example #53
0
    def test_websearch_search_services_report(self):
        """websearchadmin - availability of WebSearch "Search Services" Admin pages"""

        url = CFG_SITE_URL + '/admin/websearch/websearchadmin.py?colID=1&mtype=perform_checksearchservices&ln=en'
        error_messages = test_web_page_content(
            url,
            username='******',
            password='',
            expected_text=['OK', 'JournalHintService'])
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
 def test_robot_login_method_changed_email(self):
     """webaccess - robot login method changed email"""
     for method_name, method in self.robot_login_methods.iteritems():
         url = method.test_create_example_url(self.a_email, method_name, self.a_robot, self.myip, nickname=self.a_nickname)
         url2 = method.test_create_example_url(self.another_email, method_name, self.a_robot, self.myip, nickname=self.a_nickname)
         try:
             error_messages = test_web_page_content(url, expected_text=self.a_nickname)
             if error_messages:
                 self.fail(merge_error_messages(error_messages))
             id_user = run_sql("SELECT id FROM user WHERE email=%s", (self.a_email, ))[0][0]
             self.failUnless(run_sql("SELECT * FROM userEXT WHERE id=%s AND id_user=%s AND method=%s", (self.a_nickname, id_user, method_name)), "Can't find id %s for user %s with metod %s. userEXT contains: %s" % (self.a_nickname, id_user, method_name, run_sql("SELECT * FROM userEXT")))
             error_messages = test_web_page_content(url2, expected_text=self.a_nickname)
             if error_messages:
                 self.fail(merge_error_messages(error_messages))
             id_user2 = run_sql("SELECT id FROM user WHERE email=%s", (self.another_email, ))[0][0]
             self.assertEqual(id_user, id_user2)
             self.failUnless(run_sql("SELECT * FROM userEXT WHERE id=%s AND id_user=%s AND method=%s", (self.a_nickname, id_user2, method_name)))
             ## The old email should not exist any longer.
             self.failIf(run_sql("SELECT * FROM user WHERE email=%s", (self.a_email, )))
         finally:
             self._erase_example_user_and_groups()
    def test_restricted_article_in_released_issue(self):
        """webjournal - check access to restricted article in released issue"""

        # Record is not public
        self.assertEqual(record_public_p(112), False)

        # Released article (even if restricted) is visible to guest
        error_messages = test_web_page_content(CFG_SITE_URL + '/journal/AtlantisTimes/2009/03/Science/111' ,
                                               expected_text=["Scissor-beak"],
                                               unexpected_text=["A naturalist's voyage around the world"])
        if error_messages:
            self.fail(merge_error_messages(error_messages))
    def test_no_broken_search_services_(self):
        """websearch - no broken search services"""
        error_messages = []
        search_service_plugins = PluginContainer(os.path.join(CFG_SEARCH_SERVICES_PATH, '*Service.py'),
                                                 api_version=__required_plugin_API_version__,
                                                 plugin_signature=SearchService)
        for name, error in search_service_plugins.get_broken_plugins().iteritems():
            error_messages.append("Service '%s' could not be loaded:\n%s" % \
                                  (name, repr(error[0]) + " " + repr(error[1]) + "\n" + "\n".join(traceback.format_tb(error[2]))))

        if error_messages:
            self.fail(merge_error_messages(error_messages))
    def test_restricted_article_in_released_issue(self):
        """webjournal - check access to restricted article in released issue"""

        # Record is not public
        self.assertEqual(record_public_p(112), False)

        # Released article (even if restricted) is visible to guest
        error_messages = test_web_page_content(
            CFG_SITE_URL + '/journal/AtlantisTimes/2009/03/Science/111',
            expected_text=["Scissor-beak"],
            unexpected_text=["A naturalist's voyage around the world"])
        if error_messages:
            self.fail(merge_error_messages(error_messages))
    def test_your_baskets_pages_availability(self):
        """errorlib - availability of error sending pages"""

        baseurl = CFG_SITE_URL + '/error/'

        _exports = ['', 'send']

        error_messages = []
        for url in [baseurl + page for page in _exports]:
            error_messages.extend(test_web_page_content(url))
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
Example #59
0
    def test_similar_records_pages_availability(self):
        """bibrank - availability of similar records results pages"""

        baseurl = CFG_SITE_URL + '/search'

        _exports = ['?p=recid%3A18&rm=wrd']

        error_messages = []
        for url in [baseurl + page for page in _exports]:
            error_messages.extend(test_web_page_content(url))
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
Example #60
0
    def test_your_loans_page_availability(self):
        """bibcirculation - availability of your loans page"""

        baseurl = CFG_SITE_URL + '/yourloans/'

        _exports = ['', 'display', 'loanshistoricaloverview']

        error_messages = []
        for url in [baseurl + page for page in _exports]:
            error_messages.extend(test_web_page_content(url))
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return