예제 #1
0
    def test_validate_rights_model(self) -> None:
        invalid_commit_cmd_model = exp_models.ExplorationCommitLogEntryModel(
            id='rights_id123',
            created_on=self.YEAR_AGO,
            last_updated=self.NOW,
            commit_type='test-type',
            user_id='',
            exploration_id='123',
            post_commit_status='private',
            commit_cmds=[{'cmd': 'create_new'}])

        output = (
            self.pipeline
            | beam.Create([invalid_commit_cmd_model])
            | beam.ParDo(
                exp_validation.ValidateExplorationCommitLogEntryModel())
        )

        self.assert_pcoll_equal(output, [])
예제 #2
0
    def test_validate_exploration_model(self):
        invalid_commit_cmd_model = exp_models.ExplorationCommitLogEntryModel(
            id='exploration_id123',
            created_on=self.YEAR_AGO,
            last_updated=self.NOW,
            commit_type='test-type',
            user_id='',
            exploration_id='123',
            post_commit_status='private',
            commit_cmds=[{
                'cmd': base_models.VersionedModel.CMD_DELETE_COMMIT
            }])

        output = (self.pipeline
                  | beam.Create([invalid_commit_cmd_model])
                  | beam.ParDo(
                      exp_validation.ValidateExplorationCommitLogEntryModel()))

        self.assert_pcoll_equal(output, [])