Exemplo n.º 1
0
    def test_send_message_later(self):
        """webmessage - web test send a message later"""

        self.browser.get(CFG_SITE_SECURE_URL)
        # login as romeo
        self.login(username="******", password="******")
        # let's go to "Your Messages"
        self.find_element_by_link_text_with_timeout("Personalize")
        self.browser.find_element_by_link_text("Personalize").click()
        self.find_element_by_link_text_with_timeout("Your Messages")
        self.browser.find_element_by_link_text("Your Messages").click()
        self.find_element_by_name_with_timeout("del_all")
        self.browser.find_element_by_name("del_all").click()
        self.handle_popup_dialog()
        self._compose_message(users="juliet", subject="dear juliet", body= "i love you")
        self.choose_selectbox_option_by_label(selectbox_name="msg_send_day",label= "4")
        self.choose_selectbox_option_by_label(selectbox_name="msg_send_month", label="July")
        self.find_element_by_name_with_timeout("send_button")
        self.browser.find_element_by_name("send_button").click()
        self.page_source_test(expected_text='The chosen date (0/7/4) is invalid')
        self.choose_selectbox_option_by_label(selectbox_name="msg_send_year", label="2019")
        self.find_element_by_name_with_timeout("send_button")
        self.browser.find_element_by_name("send_button").click()
        self.page_source_test(expected_text='Your message has been sent')
        self.logout()

TEST_SUITE = make_test_suite(InvenioWebMessageWebTest, )

if __name__ == '__main__':
    run_test_suite(TEST_SUITE, warn_user=True)
    def setUp(self):
        # pylint: disable=C0103
        """Initialize stuff"""
        self.recid = 339705
        self.recids = [339705, 339706]
        self.rank_method_code = 'citation'

    def xtest_init_cited_by_dictionary(self):
        """bibrank citation searcher - init cited-by data"""
        # FIXME: test postponed
        #self.assert_(bibrank_citation_searcher.init_cited_by_dictionary())

    def xtest_init_reference_list_dictionary(self):
        """bibrank citation searcher - init reference data"""
        # FIXME: test postponed
        #self.assert_(bibrank_citation_searcher.init_reference_list_dictionary())

    def xtest_calculate_cited_by_list(self):
        """bibrank citation searcher - get citing relevance"""
        # FIXME: test postponed

    def xtest_calculate_co_cited_with_list(self):
        """bibrank citation searcher - get co-cited-with data"""
        # FIXME: test postponed

TEST_SUITE = make_test_suite(TestCitationSearcher,)

if __name__ == "__main__":
    run_test_suite(TEST_SUITE)

Exemplo n.º 3
0
    def test_validation_compare_title(self):
        """BibMatch comparison: compare title"""
        original_record_instances = ['Assault frequency and preformation probability']
        matched_record_instances = ['Assault frequency and preformation probability : The alpha emission process']
        comparisons = get_paired_comparisons(original_record_instances, matched_record_instances)
        threshold = 0.9
        matches_needed = 1
        # This should fail
        result, dummy = compare_fieldvalues_normal(comparisons, threshold, matches_needed)
        self.assertFalse(result)
        # Title search however, takes separators into account
        result, dummy = compare_fieldvalues_title(comparisons, threshold, matches_needed)
        self.assertTrue(result)

        # Check longer titles
        original_record_instances = ['Buffered Electropolishing \xe2\x80\x93 A New Way for ' \
                                     'Achieving Extremely Smooth Surface Finish on Nb SRF ' \
                                     'Cavities to be Used in Particle Accelerators']
        matched_record_instances = ['Buffered Electropolishing: A New Way for Achieving ' \
                                    'Extremely Smooth Surface Finish on Nb SRF Cavities ' \
                                    'To be Used in Particle Accelerators']
        comparisons = get_paired_comparisons(original_record_instances, matched_record_instances)
        result, dummy = compare_fieldvalues_title(comparisons, threshold, matches_needed)
        self.assertTrue(result)


TEST_SUITE = make_test_suite(BibMatchTest)

if __name__ == "__main__":
    run_test_suite(TEST_SUITE, warn_user=False)
Exemplo n.º 4
0
        setup_loggers(verbosity=9)
        from invenio import refextract_kbs
        self.old_override = refextract_kbs.CFG_REFEXTRACT_KBS_OVERRIDE
        refextract_kbs.CFG_REFEXTRACT_KBS_OVERRIDE = {}

    def tearDown(self):
        from invenio import refextract_kbs
        refextract_kbs.CFG_REFEXTRACT_KBS_OVERRIDE = self.old_override

    def test_not_recognized(self):
        field, pattern = search_from_reference('[1] J. Mars, oh hello')
        self.assertEqual(field, '')
        self.assertEqual(pattern, '')

    def test_report(self):
        field, pattern = search_from_reference('[1] J. Mars, oh hello, [hep-ph/0104088]')
        self.assertEqual(field, 'report')
        self.assertEqual(pattern, 'hep-ph/0104088')

    def test_journal(self):
        field, pattern = search_from_reference('[1] J. Mars, oh hello, Nucl.Phys. B76 (1974) 477-482')
        self.assertEqual(field, 'journal')
        self.assert_('Nucl' in pattern)
        self.assert_('B76' in pattern)
        self.assert_('477' in pattern)


if __name__ == '__main__':
    test_suite = make_test_suite(IbidTest, TagNumerationTest)
    run_test_suite(test_suite)
Exemplo n.º 5
0
        """urlutils - test creation of HTML "mailto" links, obfuscation mode 3"""
        self.assertEqual(
            create_html_mailto('*****@*****.**',
                               subject='Hey there',
                               body='Lunch at 8pm?\ncu!',
                               bcc='*****@*****.**',
                               link_label="Date creator",
                               linkattrd={'style': 'text-decoration: blink'},
                               email_obfuscation_mode=3),
            '<script language="JavaScript" type="text/javascript">document.write(\'>a/<rotaerc etaD>"knilb :noitaroced-txet"=elyts "ereht02%yeH=tcejbus;pma&hc.nrec.sdc04%oemor=ccb;pma&12%ucA0%D0%F3%mp802%ta02%hcnuL=ydob?hc.nrec.sdc@teiluj:otliam"=ferh a<\'.split("").reverse().join(""))</script>'
        )

    def test_html_mailto_obfuscation_mode_4(self):
        """urlutils - test creation of HTML "mailto" links, obfuscation mode 4"""
        self.assertEqual(create_html_mailto('*****@*****.**',
                                            subject='Hey there',
                                            body='Lunch at 8pm?\ncu!',
                                            bcc='*****@*****.**',
                                            link_label="Date creator",
                                            linkattrd={'style': 'text-decoration: blink'},
                                            email_obfuscation_mode=4),
                         'juliet<img src="%(CFG_SITE_URL)s/img/at.gif" alt=" [at] " style="vertical-align:baseline" />cds<img src="%(CFG_SITE_URL)s/img/dot.gif" alt=" [dot] " style="vertical-align:bottom"  />cern<img src="%(CFG_SITE_URL)s/img/dot.gif" alt=" [dot] " style="vertical-align:bottom"  />ch' % \
                         {'CFG_SITE_URL': CFG_SITE_URL})


TEST_SUITE = make_test_suite(TestWashUrlArgument, TestUrls, TestHtmlLinks,
                             TestEmailObfuscationMode)

if __name__ == "__main__":
    run_test_suite(TEST_SUITE)
Exemplo n.º 6
0
        _exports = ['', 'editsource', 'addsource', 'delsource']

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

        url = 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


TEST_SUITE = make_test_suite(OAIHarvestAdminWebPagesAvailabilityTest)

if __name__ == "__main__":
    run_test_suite(TEST_SUITE, warn_user=True)
Exemplo n.º 7
0
class DuplicatedSignaturesTestCase(BibAuthorIDHooverTestCase):
    @classmethod
    def setUpClass(self):
        BibAuthorIDHooverTestCase.setUpClass()

    @classmethod
    def tearDownClass(self):
        pass

    def test_duplicated_signatures(self):
        def duplicated_claimed_signature():
            self.assertEquals(dupl, 1)

        def duplicated_unclaimed_signature():
            inspireID = get_inspire_id_of_author(pid)
            author_papers = get_papers_of_author(pid)
            self.assertEquals(len(author_papers), 1)

        duplicated_claimed_signature()
        duplicated_unclaimed_signature()


TEST_SUITE = make_test_suite(OneAuthorOnePaperHooverTestCase,
                             OneAuthorManyPapersHooverTestCase,
                             ManyAuthorsHooverTestCase,
                             DuplicatedSignaturesTestCase)

if __name__ == "__main__":
    run_test_suite(TEST_SUITE, warn_user=False)
    BibAuthorIDHooverTestCase.tearDownClass()