def test_model_with_valid_draft_change_list_last_updated(self): model = user_models.ExplorationUserDataModel( id='123', user_id=self.VALID_USER_ID, exploration_id=self.VALID_EXPLORATION_ID, draft_change_list=self.VALID_DRAFT_CHANGE_LIST, draft_change_list_last_updated=(self.NOW - datetime.timedelta(days=2)), created_on=self.NOW - datetime.timedelta(days=3), last_updated=self.NOW - datetime.timedelta(days=2)) output = (self.pipeline | beam.Create([model]) | beam.ParDo( user_validation.ValidateDraftChangeListLastUpdated())) self.assert_pcoll_equal(output, [])
def test_model_with_draft_change_list_but_no_last_updated(self): model = user_models.ExplorationUserDataModel( id='123', user_id=self.VALID_USER_ID, exploration_id=self.VALID_EXPLORATION_ID, draft_change_list=self.VALID_DRAFT_CHANGE_LIST, draft_change_list_last_updated=None, created_on=self.NOW, last_updated=self.NOW) output = (self.pipeline | beam.Create([model]) | beam.ParDo( user_validation.ValidateDraftChangeListLastUpdated())) self.assert_pcoll_equal(output, [ user_validation_errors.DraftChangeListLastUpdatedNoneError(model) ])