def setUp(self):
    super(CollectionSummaryModelValidatorTests, self).setUp()
    self.signup(self.OWNER_EMAIL, self.OWNER_USERNAME)
    self.signup(USER_EMAIL, USER_NAME)
    self.user_id = self.get_user_id_from_email(USER_EMAIL)
    self.owner_id = self.get_user_id_from_email(self.OWNER_EMAIL)
    self.owner = user_services.UserActionsInfo(self.owner_id)
    editor_email = 'example@example.com'
    viewer_email = 'example@example.com'
    contributor_email = 'example@example.com'
    self.signup(editor_email, 'editor')
    self.signup(viewer_email, 'viewer')
    self.signup(contributor_email, 'contributor')
    self.editor_id = self.get_user_id_from_email(editor_email)
    self.viewer_id = self.get_user_id_from_email(viewer_email)
    self.contributor_id = self.get_user_id_from_email(contributor_email)
    explorations = [exp_domain.Exploration.create_default_exploration(('%s' % i), title=('title %d' % i), category=('category%d' % i)) for i in xrange(6)]
    for exp in explorations:
        exp_services.save_new_exploration(self.owner_id, exp)
    language_codes = ['ar', 'en', 'en']
    collections = [collection_domain.Collection.create_default_collection(('%s' % i), title=('title %d' % i), category=('category%d' % i), objective=('objective%d' % i), language_code=language_codes[i]) for i in xrange(3)]
    for (index, collection) in enumerate(collections):
        collection.add_node(('%s' % (index * 2)))
        collection.add_node(('%s' % ((index * 2) + 1)))
        collection.tags = ['math', 'art']
        collection_services.save_new_collection(self.owner_id, collection)
    rights_manager.assign_role_for_collection(self.owner, '0', self.editor_id, rights_manager.ROLE_EDITOR)
    collection_services.update_collection(self.contributor_id, '0', [{'cmd': 'edit_collection_property', 'property_name': 'title', 'new_value': 'New title'}], 'Changes.')
    rights_manager.assign_role_for_collection(self.owner, '2', self.viewer_id, rights_manager.ROLE_VIEWER)
    self.model_instance_0 = collection_models.CollectionSummaryModel.get_by_id('0')
    self.model_instance_0.put()
    self.model_instance_1 = collection_models.CollectionSummaryModel.get_by_id('1')
    self.model_instance_2 = collection_models.CollectionSummaryModel.get_by_id('2')
    self.job_class = prod_validation_jobs_one_off.CollectionSummaryModelAuditOneOffJob
def setUp(self):
    super(CollectionSummaryModelValidatorTests, self).setUp()
    self.signup(self.OWNER_EMAIL, self.OWNER_USERNAME)
    self.signup(USER_EMAIL, USER_NAME)
    self.user_id = self.get_user_id_from_email(USER_EMAIL)
    self.owner_id = self.get_user_id_from_email(self.OWNER_EMAIL)
    self.owner = user_services.UserActionsInfo(self.owner_id)
    editor_email = 'example@example.com'
    viewer_email = 'example@example.com'
    contributor_email = 'example@example.com'
    self.signup(editor_email, 'editor')
    self.signup(viewer_email, 'viewer')
    self.signup(contributor_email, 'contributor')
    self.editor_id = self.get_user_id_from_email(editor_email)
    self.viewer_id = self.get_user_id_from_email(viewer_email)
    self.contributor_id = self.get_user_id_from_email(contributor_email)
    explorations = [exp_domain.Exploration.create_default_exploration(('%s' % i), title=('title %d' % i), category=('category%d' % i)) for i in xrange(6)]
    for exp in explorations:
        exp_services.save_new_exploration(self.owner_id, exp)
    language_codes = ['ar', 'en', 'en']
    collections = [collection_domain.Collection.create_default_collection(('%s' % i), title=('title %d' % i), category=('category%d' % i), objective=('objective%d' % i), language_code=language_codes[i]) for i in xrange(3)]
    for (index, collection) in enumerate(collections):
        collection.add_node(('%s' % (index * 2)))
        collection.add_node(('%s' % ((index * 2) + 1)))
        collection.tags = ['math', 'art']
        collection_services.save_new_collection(self.owner_id, collection)
    rights_manager.assign_role_for_collection(self.owner, '0', self.editor_id, rights_manager.ROLE_EDITOR)
    collection_services.update_collection(self.contributor_id, '0', [{'cmd': 'edit_collection_property', 'property_name': 'title', 'new_value': 'New title'}], 'Changes.')
    rights_manager.assign_role_for_collection(self.owner, '2', self.viewer_id, rights_manager.ROLE_VIEWER)
    self.model_instance_0 = collection_models.CollectionSummaryModel.get_by_id('0')
    self.model_instance_0.put()
    self.model_instance_1 = collection_models.CollectionSummaryModel.get_by_id('1')
    self.model_instance_2 = collection_models.CollectionSummaryModel.get_by_id('2')
    self.job_class = prod_validation_jobs_one_off.CollectionSummaryModelAuditOneOffJob