def test_add_commit_cmds_user_ids_to_exploration_rights_snapshot(self):
    with self.exploration_rights_model_swap:
        exp_model = exp_models.ExplorationRightsModel(id=self.EXP_1_ID, owner_ids=[self.USER_1_ID, self.USER_2_ID], editor_ids=[self.USER_2_ID], voice_artist_ids=[], viewer_ids=[], community_owned=False, status=constants.ACTIVITY_STATUS_PUBLIC, viewable_if_private=False, first_published_msec=0.0)
        exp_model.save('cid', 'Created new exploration rights', [{'cmd': rights_domain.CMD_CREATE_NEW}])
        exp_model.owner_ids = [self.USER_3_ID]
        exp_model.save('cid', 'Change owner', [{'cmd': rights_domain.CMD_CHANGE_ROLE, 'assignee_id': self.USER_3_ID, 'old_role': rights_domain.ROLE_NONE, 'new_role': rights_domain.ROLE_OWNER}])
    output = self._run_one_off_job()
    self.assertEqual(output, [['SUCCESS-ExplorationRightsSnapshotMetadataModel', 2]])
    self.assertItemsEqual([], exp_models.ExplorationRightsSnapshotMetadataModel.get_by_id(('%s-1' % self.EXP_1_ID)).commit_cmds_user_ids)
    self.assertItemsEqual([self.USER_3_ID], exp_models.ExplorationRightsSnapshotMetadataModel.get_by_id(('%s-2' % self.EXP_1_ID)).commit_cmds_user_ids)
def test_add_commit_cmds_user_ids_to_exploration_rights_snapshot(self):
    with self.exploration_rights_model_swap:
        exp_model = exp_models.ExplorationRightsModel(id=self.EXP_1_ID, owner_ids=[self.USER_1_ID, self.USER_2_ID], editor_ids=[self.USER_2_ID], voice_artist_ids=[], viewer_ids=[], community_owned=False, status=constants.ACTIVITY_STATUS_PUBLIC, viewable_if_private=False, first_published_msec=0.0)
        exp_model.save('cid', 'Created new exploration rights', [{'cmd': rights_domain.CMD_CREATE_NEW}])
        exp_model.owner_ids = [self.USER_3_ID]
        exp_model.save('cid', 'Change owner', [{'cmd': rights_domain.CMD_CHANGE_ROLE, 'assignee_id': self.USER_3_ID, 'old_role': rights_domain.ROLE_NONE, 'new_role': rights_domain.ROLE_OWNER}])
    output = self._run_one_off_job()
    self.assertEqual(output, [['SUCCESS-ExplorationRightsSnapshotMetadataModel', 2]])
    self.assertItemsEqual([], exp_models.ExplorationRightsSnapshotMetadataModel.get_by_id(('%s-1' % self.EXP_1_ID)).commit_cmds_user_ids)
    self.assertItemsEqual([self.USER_3_ID], exp_models.ExplorationRightsSnapshotMetadataModel.get_by_id(('%s-2' % self.EXP_1_ID)).commit_cmds_user_ids)