コード例 #1
0
    def test_check_for_finalized_bill_bill_is_finalized(self):
        """Verify that a file with invoice_id is marked as finalzed."""
        data = []

        with open(self.test_report, 'r') as f:
            reader = csv.DictReader(f)
            for row in reader:
                data.append(row)

        for row in data:
            row['bill/InvoiceId'] = '12345'

        tmp_file = '/tmp/test_process_finalized_rows.csv'
        field_names = data[0].keys()

        with open(tmp_file, 'w') as f:
            writer = csv.DictWriter(f, fieldnames=field_names)
            writer.writeheader()
            writer.writerows(data)

        processor = AWSReportProcessor(
            schema_name=self.schema,
            report_path=tmp_file,
            compression=UNCOMPRESSED,
            provider_uuid=self.aws_provider_uuid,
        )

        result = processor._check_for_finalized_bill()

        self.assertTrue(result)
コード例 #2
0
    def test_check_for_finalized_bill_bill_not_finalized(self):
        """Verify that a file without invoice_id is not marked as finalzed."""
        processor = AWSReportProcessor(
            schema_name=self.schema,
            report_path=self.test_report,
            compression=UNCOMPRESSED,
            provider_uuid=self.aws_provider_uuid,
        )

        result = processor._check_for_finalized_bill()

        self.assertFalse(result)
コード例 #3
0
    def test_check_for_finalized_bill_empty_bill(self):
        """Verify that an empty file is not marked as finalzed."""
        tmp_file = "/tmp/test_process_finalized_rows.csv"

        with open(tmp_file, "w"):
            pass

        processor = AWSReportProcessor(
            schema_name=self.schema,
            report_path=tmp_file,
            compression=UNCOMPRESSED,
            provider_uuid=self.aws_provider_uuid,
        )
        result = processor._check_for_finalized_bill()
        self.assertFalse(result)