Esempio n. 1
0
    def test_should_process_full_month_no_manifest(self):
        """Test that we process this manifest completely."""
        processor = AWSReportProcessor(schema_name=self.schema,
                                       report_path=self.test_report,
                                       compression=UNCOMPRESSED,
                                       provider_uuid=self.aws_provider_uuid)

        self.assertTrue(processor._should_process_full_month())
    def test_should_process_full_month_manifest_for_not_current_month(self, mock_manifest_accessor):
        """Test that we process this manifest completely."""
        mock_manifest = Mock()
        last_month = self.date_accessor.today_with_timezone('UTC') - relativedelta(months=1)
        mock_manifest.billing_period_start_datetime = last_month
        mock_manifest_accessor.return_value.__enter__.return_value.get_manifest_by_id.return_value = mock_manifest
        processor = AWSReportProcessor(
            schema_name=self.schema,
            report_path=self.test_report,
            compression=UNCOMPRESSED,
            provider_uuid=self.aws_provider_uuid,
            manifest_id=self.manifest.id,
        )

        self.assertTrue(processor._should_process_full_month())
    def test_should_process_full_month_not_first_manifest_for_bill(self, mock_manifest_accessor):
        """Test that we process a window of data for the bill/manifest."""
        mock_manifest = Mock()
        today = self.date_accessor.today_with_timezone('UTC')
        mock_manifest.billing_period_start_datetime = today
        mock_manifest.num_processed_files = 1
        mock_manifest.num_total_files = 1
        mock_manifest_accessor.return_value.__enter__.return_value.get_manifest_by_id.return_value = mock_manifest
        mock_manifest_accessor.return_value.__enter__.return_value.get_manifest_list_for_provider_and_bill_date.return_value = [mock_manifest, mock_manifest]
        processor = AWSReportProcessor(
            schema_name=self.schema,
            report_path=self.test_report,
            compression=UNCOMPRESSED,
            provider_uuid=self.aws_provider_uuid,
            manifest_id=self.manifest.id,
        )

        self.assertFalse(processor._should_process_full_month())