Esempio n. 1
0
    def test_format_authority_browsing_pre_and_successor(self):
        """bibformat - test format authority browsing pre and successor"""
        base = "/record/140/"
        parameters = {}
        url = make_url(base, **parameters)

        error_messages = []
        browser = get_authenticated_mechanize_browser("admin", "")
        browser.open(url)
        link = browser.find_link(text_regex=re.compile("2 dependent records"))
        resp = browser.follow_link(link)
        link = browser.find_link(text_regex=re.compile("Detailed record"),
                                 nr=1)
        resp = browser.follow_link(link)
        found = self.re_institution.search(resp.read())
        if not found:
            error_messages.append(
                "There is no 'Werkstoffsynthese und Herstellverfahren' in html response."
            )
        link = browser.find_link(text_regex=re.compile("1 dependent record"))
        resp = browser.follow_link(link)
        found = self.re_institution.search(resp.read())
        if not found:
            error_messages.append(
                "There is no 'Werkstoffsynthese und Herstellverfahren' in html response."
            )
        self.assertEqual([], error_messages)
    def _perform_search(self, browser, search_criteria):
        """Perform search in an existing browser using the specified criteria.
        Calling the method is equal of typing the criteria in the search box
        and pressing the 'search' button."""

        # open the search page that in our case is the default page
        browser.open(make_url('/'))

        # perform search
        browser.select_form(name = 'search')
        browser['p'] = search_criteria
        browser.submit(name = 'action_search')
Esempio n. 3
0
    def _perform_search(self, browser, search_criteria):
        """Perform search in an existing browser using the specified criteria.
        Calling the method is equal of typing the criteria in the search box
        and pressing the 'search' button."""

        # open the search page that in our case is the default page
        browser.open(make_url('/'))

        # perform search
        browser.select_form(name = 'search')
        browser['p'] = search_criteria
        browser.submit(name = 'action_search')
    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))
    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))
    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))
    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))
    def test_format_authority_browsing_cern(self):
        """bibformat - test format authority browsing cern authority record"""
        base = "/record/12/"
        parameters = {}
        url = make_url(base, **parameters)

        error_messages = []
        browser = get_authenticated_mechanize_browser("admin", "")
        browser.open(url)
        link = browser.find_link(text_regex=re.compile("CERN"))
        resp = browser.follow_link(link)
        found = self.re_cern_control_number.search(resp.read())
        if not found:
            error_messages.append("There is no CERN control number in html response.")
        self.assertEqual([], error_messages)
    def test_format_authority_browsing_pre_and_successor(self):
        """bibformat - test format authority browsing pre and successor"""
        base = "/record/140/"
        parameters = {}
        url = make_url(base, **parameters)

        error_messages = []
        browser = get_authenticated_mechanize_browser("admin", "")
        browser.open(url)
        link = browser.find_link(text_regex=re.compile("3 dependent record"))
        resp = browser.follow_link(link)
        found = self.re_institute.search(resp.read())
        if not found:
            error_messages.append("There is no 'Werkstoffsynthese und Herstellverfahren' in html response.")
        self.assertEqual([], error_messages)
    def test_format_authority_browsing_ellis(self):
        """bibformat - test format authority browsing Ellis authority record"""
        base = "/record/12/"
        parameters = {}
        url = make_url(base, **parameters)

        error_messages = []
        browser = get_authenticated_mechanize_browser("admin", "")
        browser.open(url)
        link = browser.find_link(text_regex=re.compile("Ellis, J"))
        resp = browser.follow_link(link)
        link = browser.find_link(text_regex=re.compile("See all 4 publications..."))
        resp = browser.follow_link(link)
        found = self.re_non_compact.search(resp.read())
        if not found:
            error_messages.append("There is no 'Non-compact supergravity' in html response.")
        self.assertEqual([], error_messages)
    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))
    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))
    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))
    def test_format_authority_browsing_parent_child(self):
        """bibformat - test format authority browsing parent child"""
        base = "/record/129/"
        parameters = {}
        url = make_url(base, **parameters)

        error_messages = []
        browser = get_authenticated_mechanize_browser("admin", "")
        browser.open(url)
        link = browser.find_link(text_regex=re.compile("Institut für Kernphysik"))
        resp = browser.follow_link(link)
        link = browser.find_link(text_regex=re.compile("Forschungszentrum Jülich"))
        resp = browser.follow_link(link)
        link = browser.find_link(text_regex=re.compile("6 dependent records"))
        resp = browser.follow_link(link)
        found = self.re_institute_energy.search(resp.read())
        if not found:
            error_messages.append("There is no 'Institut für Energieforschung' in html response.")
        self.assertEqual([], error_messages)
    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))