Ejemplo n.º 1
0
    def test_process_reports_model_mutated_during_job_error(self):
        invalid_timestamp = base_models.BaseModel(id='124',
                                                  created_on=self.NOW,
                                                  last_updated=self.YEAR_LATER)

        output = (self.pipeline
                  | beam.Create([invalid_timestamp])
                  | beam.ParDo(base_model_audits.ValidateModelTimestamps()))

        self.assert_pcoll_equal(output, [
            audit_errors.ModelMutatedDuringJobError(invalid_timestamp),
        ])
Ejemplo n.º 2
0
    def test_process_reports_model_timestamp_relationship_error(self):
        invalid_timestamp = base_models.BaseModel(id='123',
                                                  created_on=self.NOW,
                                                  last_updated=self.YEAR_AGO)

        output = (self.pipeline
                  | beam.Create([invalid_timestamp])
                  | beam.ParDo(base_model_audits.ValidateModelTimestamps()))

        self.assert_pcoll_equal(output, [
            audit_errors.InconsistentTimestampsError(invalid_timestamp),
        ])