コード例 #1
0
    def test_landing_page_is_not_published(self):
        """
        SCENARIO:  A landing page indicates that it is not published.

        EXPECTED RESULT:  A SkipError is raised.
        """

        package = 'tests.data.cuahsi.81e947faccf04de59392dddaac77bc75'
        contents = ir.read_text(package, 'landing_page.not_published.html')
        doc = lxml.etree.HTML(contents)

        obj = CUAHSIHarvester()

        with self.assertLogs(logger=obj.logger, level='DEBUG'):
            with self.assertRaises(SkipError):
                obj.preprocess_landing_page(doc)
コード例 #2
0
    def test_landing_page_does_not_have_sharing_status_element(self):
        """
        SCENARIO:  A landing page does not have a sharing status element.
        Such an element is needed because we only wish to harvest PUBLISHED
        documents.

        EXPECTED RESULT:  A SkipError is raised.
        """

        package = 'tests.data.cuahsi.81e947faccf04de59392dddaac77bc75'
        contents = ir.read_text(package, 'landing_page.no_sharing_status.html')
        doc = lxml.etree.HTML(contents)

        obj = CUAHSIHarvester()

        with self.assertLogs(logger=obj.logger, level='DEBUG'):
            with self.assertRaises(SkipError):
                obj.preprocess_landing_page(doc)