def test_check_source_filename(self):
        verifier = ProductVerifier('20100505121116-ESACCI-L2P_GHRSST-SSTskin-AVHRRMTA_G-EXP1.2-v02.0-fv1.0.nc')
        product_type = verifier._check_source_filename()
        self.assertIsInstance(product_type, L2P)

        report = verifier.get_report()
        self.assertEquals(0, report['source_filename_check'])
Пример #2
0
    def run(self):
        source_pathnames = self.glob_source_pathnames()

        print ProductVerifier.get_current_time(), \
            "found " + str(len(source_pathnames)) + " source files in '" + self.source_dirpath + "'"

        for source_pathname in source_pathnames:
            print ProductVerifier.get_current_time(
            ), "source pathname:", source_pathname
            report_filename = path.basename(source_pathname) + ".json"
            report_pathname = path.join(self.report_dirpath, report_filename)
            print ProductVerifier.get_current_time(
            ), "report pathname:", report_pathname
            verifier = ProductVerifier(source_pathname, report_pathname)
            verifier.verify()
    def test_check_source_pathname(self):
        verifier = ProductVerifier('20100505121116-ESACCI-L2P_GHRSST-SSTskin-AVHRRMTA_G-EXP1.2-v02.0-fv1.0.nc')
        try:
            verifier._check_source_pathname()
            self.fail()
        except VerificationError:
            report = verifier.get_report()
            self.assertEquals(1, report['source_pathname_check'])

        ProductVerifierTests.create_new_file(verifier.get_source_pathname())
        try:
            verifier._check_source_pathname()
            report = verifier.get_report()
            self.assertEquals(0, report['source_pathname_check'])
        finally:
            os.remove(verifier.get_source_pathname())
    def test_verify(self):
        verifier = ProductVerifier('testdata/20100505121116-ESACCI-L2P_GHRSST-SSTskin-AVHRRMTA_G-EXP1.2-v02.0-fv1.0.nc')
        verifier.verify()

        expected_report = ProductVerifier.load_report('testdata/report.json')
        self.assertEquals(expected_report, verifier.get_report())