def setUpClass(cls): super(StateChangeEmailTests, cls).setUpClass() cls.user = UserFactory() cls.user_2 = UserFactory() cls.user_3 = UserFactory() cls.site = Site.objects.get(pk=settings.SITE_ID) cls.group = factories.GroupFactory() cls.user.groups.add(cls.group) cls.user_2.groups.add(cls.group) cls.user_3.groups.add(cls.group) cls.seat = factories.SeatFactory() cls.course_run = cls.seat.course_run cls.course = cls.course_run.course assign_perm(Course.VIEW_PERMISSION, cls.group, cls.course) # NOTE: We intentionally do NOT create an attribute for user_2. # By default this user WILL receive email notifications. UserAttributeFactory(user=cls.user, enable_email_notification=True) UserAttributeFactory(user=cls.user_3, enable_email_notification=False) toggle_switch('enable_publisher_email_notifications', True)
def setUp(self): super(CommentsEmailTests, self).setUp() self.user = UserFactory() self.user_2 = UserFactory() self.user_3 = UserFactory() self.site = Site.objects.get(pk=settings.SITE_ID) self.group = factories.GroupFactory(name='abc') self.user.groups.add(self.group) self.user_2.groups.add(self.group) self.user_3.groups.add(self.group) self.seat = factories.SeatFactory() self.course_run = self.seat.course_run self.course = self.course_run.course assign_perm(Course.VIEW_PERMISSION, self.group, self.course) # NOTE: We intentionally do NOT create an attribute for user_2. # By default this user WILL receive email notifications. UserAttributeFactory(user=self.user, enable_email_notification=True) UserAttributeFactory(user=self.user_3, enable_email_notification=False) toggle_switch('enable_publisher_email_notifications', True)
def setUp(self): super(CommentsEmailTests, self).setUp() self.user = UserFactory() self.user_2 = UserFactory() self.user_3 = UserFactory() self.site = Site.objects.get(pk=settings.SITE_ID) self.organization_extension = factories.OrganizationExtensionFactory() self.seat = factories.SeatFactory() self.course_run = self.seat.course_run self.course = self.course_run.course self.course.organizations.add(self.organization_extension.organization) # NOTE: We intentionally do NOT create an attribute for user_2. # By default this user WILL receive email notifications. # add user in course-user-role table factories.CourseUserRoleFactory( course=self.course, role=PublisherUserRole.ProjectCoordinator, user=self.user) factories.CourseUserRoleFactory( course=self.course, role=PublisherUserRole.ProjectCoordinator, user=self.user_2) factories.CourseUserRoleFactory( course=self.course, role=PublisherUserRole.ProjectCoordinator, user=self.user_3) UserAttributeFactory(user=self.user, enable_email_notification=True) UserAttributeFactory(user=self.user_3, enable_email_notification=False) toggle_switch('enable_publisher_email_notifications', True) self.url = 'http://www.test.com'
def setUp(self): super(StudioInstanceCreatedEmailTests, self).setUp() self.user = UserFactory() self.group = factories.GroupFactory() self.user.groups.add(self.group) self.course_run = factories.CourseRunFactory() assign_perm(Course.VIEW_PERMISSION, self.group, self.course_run.course) UserAttributeFactory(user=self.user, enable_email_notification=True) toggle_switch('enable_publisher_email_notifications', True)
def setUp(self): super(SEOReviewEmailTests, self).setUp() self.user = UserFactory() self.course_state = factories.CourseStateFactory() self.course = self.course_state.course self.course.organizations.add(OrganizationFactory()) factories.CourseUserRoleFactory(course=self.course, role=PublisherUserRole.CourseTeam, user=self.user) self.legal_user = UserFactory() self.legal_user.groups.add( Group.objects.get(name=LEGAL_TEAM_GROUP_NAME)) UserAttributeFactory(user=self.user, enable_email_notification=True)
def setUp(self): super(CourseCreatedEmailTests, self).setUp() self.user = UserFactory() self.course_run = factories.CourseRunFactory() # add user in course-user-role table factories.CourseUserRoleFactory( course=self.course_run.course, role=PublisherUserRole.ProjectCoordinator, user=self.user) self.course_team = UserFactory() factories.CourseUserRoleFactory(course=self.course_run.course, role=PublisherUserRole.CourseTeam, user=self.course_team) UserAttributeFactory(user=self.user, enable_email_notification=True)
def setUp(self): super(StudioInstanceCreatedEmailTests, self).setUp() self.user = UserFactory() self.course_run = factories.CourseRunFactory( lms_course_id='course-v1:edX+DemoX+Demo_Course') # add user in course-user-role table factories.CourseUserRoleFactory( course=self.course_run.course, role=PublisherUserRole.ProjectCoordinator, user=self.user) self.course_team = UserFactory() factories.CourseUserRoleFactory(course=self.course_run.course, role=PublisherUserRole.CourseTeam, user=self.course_team) UserAttributeFactory(user=self.user, enable_email_notification=True) toggle_switch('enable_publisher_email_notifications', True)
def make_user(groups=None, **kwargs): user = UserFactory(**kwargs) UserAttributeFactory(user=user, enable_email_notification=True) if groups: user.groups.set(groups) return user