Ejemplo n.º 1
0
 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()
Ejemplo n.º 2
0
    def test_article_in_unreleased_issue(self):
        """webjournal - check access to unreleased article"""
        from invenio.legacy.search_engine import record_public_p

        # 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['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['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_websubmit_admin_interface_pages_availability(self):
        """websubmitadmin - availability of WebSubmit Admin interface pages"""

        baseurl = cfg["CFG_SITE_URL"] + "/admin/websubmit/websubmitadmin.py/"

        _exports = [
            "",
            "showall",
            "doctypelist",
            "doctypeadd",
            "doctyperemove",
            "actionlist",
            "jschecklist",
            "elementlist",
            "functionlist",
        ]

        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
Ejemplo n.º 4
0
    def test_bibindex_admin_interface_pages_availability(self):
        """bibindexadmin - availability of BibIndex Admin interface pages"""

        baseurl = cfg['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
Ejemplo n.º 5
0
    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, username="******", expected_text=[]))
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
Ejemplo n.º 6
0
    def test_websearch_admin_interface_pages_availability(self):
        """websearchadmin - availability of WebSearch Admin interface pages"""

        baseurl = cfg['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_oairepositoryadmin_delete_set(self):
     """oairepositoryadmin - delete set page"""
     test_edit_url = cfg["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
Ejemplo n.º 8
0
    def test_oai_server_pages_availability(self):
        """oairepository - availability of OAI server pages"""

        baseurl = cfg['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['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_websearch_admin_interface_pages_availability(self):
        """websearchadmin - availability of WebSearch Admin interface pages"""

        baseurl = cfg['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
Ejemplo n.º 10
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
Ejemplo n.º 11
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['CFG_SITE_URL'] + '/journal/AtlantisTimes/2009/03/News?ln=fr' ,
                                            expected_link_label="Scissor-beak",
                                            expected_link_target=cfg['CFG_SITE_URL'].encode('utf8') + "/journal/AtlantisTimes/2009/03/Science/111?ln=fr")
     if error_messages:
         self.fail(merge_error_messages(error_messages))
Ejemplo n.º 12
0
 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()
Ejemplo n.º 13
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_oai_admin_guide_availability(self):
        """oaiharvestadmin - availability of OAIHarvest Admin Guide"""

        url = cfg["CFG_SITE_URL"] + "/help/admin/oaiharvest-admin-guide"
        error_messages = test_web_page_content(url, expected_text="OAIHarvest Admin Guide")
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
Ejemplo n.º 15
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
Ejemplo n.º 16
0
 def test_language_handling_in_record(self):
     """webjournal - check washing of ln parameter in /record handler"""
     error_messages = test_web_page_content(cfg['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_oairepositoryadmin_delete_set(self):
     """oairepositoryadmin - delete set page"""
     test_edit_url = cfg['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_websubmit_admin_guide_availability(self):
        """websubmitadmin - availability of WebSubmit Admin guide pages"""

        url = cfg["CFG_SITE_URL"] + "/help/admin/websubmit-admin-guide"
        error_messages = test_web_page_content(url, expected_text="WebSubmit Admin Guide")
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
Ejemplo n.º 19
0
    def test_bibindex_admin_guide_availability(self):
        """bibindexadmin - availability of BibIndex Admin guide pages"""

        url = cfg['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
Ejemplo n.º 20
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['CFG_SITE_URL'] + '/journal/AtlantisTimes/2009/03/News?ln=fr',
         expected_link_label="Scissor-beak",
         expected_link_target=cfg['CFG_SITE_URL'].encode('utf8') +
         "/journal/AtlantisTimes/2009/03/Science/111?ln=fr")
     if error_messages:
         self.fail(merge_error_messages(error_messages))
Ejemplo n.º 21
0
    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
Ejemplo n.º 22
0
    def test_bibrank_admin_guide_availability(self):
        """bibrankadmin - availability of BibRank Admin guide pages"""

        url = CFG_SITE_URL + '/help/admin/bibrank-admin-guide'
        error_messages = test_web_page_content(url,
                                               expected_text="BibRank Admin Guide")
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
Ejemplo n.º 23
0
    def test_webaccess_admin_guide_availability(self):
        """webaccess - availability of WebAccess Admin guide pages"""

        url = cfg['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_oairepositoryadmin_edit_set(self):
     """oairepositoryadmin - edit set page"""
     test_edit_url = cfg['CFG_SITE_URL'] + \
            "/admin/oairepository/oairepositoryadmin.py/editset?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
Ejemplo n.º 25
0
    def test_bibformat_admin_guide_availability(self):
        """bibformatadmin - availability of BibFormat Admin guide pages"""

        url = cfg['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_oai_admin_guide_availability(self):
        """oaiharvestadmin - availability of OAIHarvest Admin Guide"""

        url = cfg['CFG_SITE_URL'] + '/help/admin/oaiharvest-admin-guide'
        error_messages = test_web_page_content(url,
                                               expected_text="OAIHarvest Admin Guide")
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
Ejemplo n.º 27
0
 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()
Ejemplo n.º 28
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()
Ejemplo n.º 29
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()
Ejemplo n.º 30
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()
Ejemplo n.º 31
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()
Ejemplo n.º 32
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()
Ejemplo n.º 33
0
    def test_change_title_index_tokenizer_configuration_back(self):
        """tests if index's tokenizer configuration can be changed back"""

        base = "/admin/bibindex/bibindexadmin.py/editindex"
        parameters = {'idxID':'8', 'ln':'en', 'mtype':'perform_modifytokenizer'}
        url = make_url(base, **parameters)

        html_response = check_admin_forms_with_dropdown_list(url, {"idxTOK":"BibIndexDefaultTokenizer"})
        success = self.re_operation_successfull.search(html_response)
        if not success:
            error_messages = """There is no "Operation successfully completed" in html response."""
            self.fail(merge_error_messages(error_messages))
Ejemplo n.º 34
0
    def test_change_title_index_remove_html_configuration(self):
        """tests if index's 'remove latex' configuration can be changed"""

        base = "/admin/bibindex/bibindexadmin.py/editindex"
        parameters = {'idxID':'8', 'ln':'en', 'mtype':'perform_modifyremovelatex'}
        url = make_url(base, **parameters)

        html_response = check_admin_forms_with_dropdown_list(url, {"idxLATEX":"Yes"})
        success = self.re_operation_successfull.search(html_response)
        if not success:
            error_messages = """There is no "Operation successfully completed" in html response."""
            self.fail(merge_error_messages(error_messages))
Ejemplo n.º 35
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()
Ejemplo n.º 36
0
 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()
Ejemplo n.º 37
0
    def test_change_title_index_knowledge_base_back(self):
        """tests if information about title index's knowledge base can be changed back"""

        base = "/admin/bibindex/bibindexadmin.py/editindex"
        parameters = {'idxID':'8', 'ln':'en', 'mtype':'perform_modifysynonymkb'}
        url = make_url(base, **parameters)

        html_response = check_admin_forms_with_dropdown_list(url, {"idxKB":"INDEX-SYNONYM-TITLE",
                                                                   "idxMATCH":"exact"})
        success = self.re_operation_successfull.search(html_response)
        if not success:
            error_messages = """There is no "Operation successfully completed." in html response."""
            self.fail(merge_error_messages(error_messages))
Ejemplo n.º 38
0
    def test_submission_pages_availability(self):
        """websubmit - availability of submission pages"""

        baseurl = cfg['CFG_SITE_URL'] + '/submit/'

        _exports = ['', 'direct']

        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
Ejemplo n.º 39
0
    def test_your_submissions_pages_availability(self):
        """websubmit - availability of Your Submissions pages"""

        baseurl = cfg['CFG_SITE_URL']

        _exports = ['/yoursubmissions.py']

        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
Ejemplo n.º 40
0
    def test_change_title_index_remove_stopword_configuration_back(self):
        """tests if index's remove stopwords configuration can be changed back"""

        base = "/admin/bibindex/bibindexadmin.py/editindex"
        parameters = {'idxID':'8', 'ln':'en', 'mtype':'perform_modifystopwords'}
        url = make_url(base, **parameters)

        html_response = check_admin_forms_with_input_text(url, {"idxSTOPWORDS":"No"})

        success = self.re_operation_successfull.search(html_response)
        if not success:
            error_messages = """There is no "Operation successfully completed" in html response."""
            self.fail(merge_error_messages(error_messages))
Ejemplo n.º 41
0
    def test_your_loans_page_availability(self):
        """bibcirculation - availability of your loans page"""

        baseurl = cfg['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
Ejemplo n.º 42
0
    def test_publiline_pages_availability(self):
        """websubmit - availability of approval pages"""

        baseurl = cfg['CFG_SITE_URL']

        _exports = ['/approve.py', '/publiline.py', '/yourapprovals.py']

        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
Ejemplo n.º 43
0
    def test_similar_records_pages_availability(self):
        """bibrank - availability of similar records results pages"""

        baseurl = cfg['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
Ejemplo n.º 44
0
    def test_rank_by_word_similarity_pages_availability(self):
        """bibrank - availability of ranking search results pages"""

        baseurl = cfg['CFG_SITE_URL'] + '/search'

        _exports = ['?p=ellis&r=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
Ejemplo n.º 45
0
    def test_restricted_article_in_released_issue(self):
        """webjournal - check access to restricted article in released issue"""
        from invenio.legacy.search_engine import record_public_p

        # 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['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))
Ejemplo n.º 46
0
    def test_your_baskets_pages_availability(self):
        """errorlib - availability of error sending pages"""

        baseurl = cfg['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
Ejemplo n.º 47
0
 def test_language_handling_in_record(self):
     """webjournal - check washing of ln parameter in /record handler"""
     error_messages = test_web_page_content(
         cfg['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))
Ejemplo n.º 48
0
    def test_your_submissions_pages_availability(self):
        """websubmit - availability of Your Submissions pages"""

        baseurl = cfg['CFG_SITE_URL']

        _exports = ['/yoursubmissions.py']

        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
Ejemplo n.º 49
0
    def test_submission_pages_availability(self):
        """websubmit - availability of submission pages"""

        baseurl = cfg['CFG_SITE_URL'] + '/submit/'

        _exports = ['', 'direct']

        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
Ejemplo n.º 50
0
    def test_restricted_article_in_released_issue(self):
        """webjournal - check access to restricted article in released issue"""
        from invenio.legacy.search_engine import record_public_p

        # 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['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))
Ejemplo n.º 51
0
    def test_your_alerts_pages_availability(self):
        """webalert - availability of Your Alerts pages"""
        from invenio.config import CFG_SITE_URL

        baseurl = CFG_SITE_URL + '/youralerts/'

        _exports = ['', 'display', 'input', 'modify', 'list', 'add',
                    'update', 'remove']

        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
Ejemplo n.º 52
0
    def test_your_message_pages_availability(self):
        """webmessage - availability of Your Messages pages"""

        baseurl = cfg['CFG_SITE_URL'] + '/yourmessages/'

        _exports = ['', 'display', 'write', 'send', 'delete', 'delete_all',
                    'display_msg']

        error_messages = []
        for url in [baseurl + page for page in _exports]:
            error_messages.extend(test_web_page_content(url,
                                                        username='******',
                                                        password='******'))
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
Ejemplo n.º 53
0
    def test_your_groups_pages_availability(self):
        """websession - availability of Your Groups pages"""

        baseurl = cfg['CFG_SITE_SECURE_URL'] + '/yourgroups/'

        _exports = [
            '', 'display', 'create', 'join', 'leave', 'edit', 'members'
        ]

        error_messages = []
        for url in [baseurl + page for page in _exports]:
            error_messages.extend(
                test_web_page_content(url, username='******', expected_text=[]))
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
Ejemplo n.º 54
0
    def test_precached_area_authorization(self):
        """webaccess - login-time precached authorizations for usebaskets"""
        error_messages = test_web_page_content(cfg['CFG_SITE_SECURE_URL'] +
                                               '/youraccount/display?ln=en',
                                               username='******',
                                               password='******',
                                               expected_text='Your Baskets')
        error_messages.extend(
            test_web_page_content(cfg['CFG_SITE_SECURE_URL'] +
                                  '/youraccount/display?ln=en',
                                  username='******',
                                  password='******',
                                  unexpected_text='Your Baskets'))

        if error_messages:
            self.fail(merge_error_messages(error_messages))
Ejemplo n.º 55
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()
Ejemplo n.º 56
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()
Ejemplo n.º 57
0
    def test_your_account_pages_availability(self):
        """websession - availability of Your Account pages"""

        baseurl = cfg['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, username='******', expected_text=[]))
        if error_messages:
            self.fail(merge_error_messages(error_messages))
        return
Ejemplo n.º 58
0
    def test_change_title_index_tokenizer_configuration_back(self):
        """tests if index's tokenizer configuration can be changed back"""

        base = "/admin/bibindex/bibindexadmin.py/editindex"
        parameters = {
            'idxID': '8',
            'ln': 'en',
            'mtype': 'perform_modifytokenizer'
        }
        url = make_url(base, **parameters)

        html_response = check_admin_forms_with_dropdown_list(
            url, {"idxTOK": "BibIndexDefaultTokenizer"})
        success = self.re_operation_successfull.search(html_response)
        if not success:
            error_messages = """There is no "Operation successfully completed" in html response."""
            self.fail(merge_error_messages(error_messages))
Ejemplo n.º 59
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()