Commit e5f5def2 by tasawernawaz Committed by Tasawer Nawaz

remove CourseTeam role from default organization roles ECOM-6929

parent c03551f7
...@@ -177,9 +177,9 @@ class Course(TimeStampedModel, ChangedByMixin): ...@@ -177,9 +177,9 @@ class Course(TimeStampedModel, ChangedByMixin):
def assign_organization_role(self, organization): def assign_organization_role(self, organization):
""" """
Create course-user-roles for the given organization against a course. Create course-user-roles except CourseTeam for the given organization against a course.
""" """
for user_role in organization.organization_user_roles.all(): for user_role in organization.organization_user_roles.exclude(role=PublisherUserRole.CourseTeam):
CourseUserRole.add_course_roles(self, user_role.role, user_role.user) CourseUserRole.add_course_roles(self, user_role.role, user_role.user)
@property @property
......
...@@ -178,8 +178,8 @@ class CourseTests(TestCase): ...@@ -178,8 +178,8 @@ class CourseTests(TestCase):
def test_assign_roles(self): def test_assign_roles(self):
""" """
Verify that method `assign_organization_role' assign course-user-roles Verify that method `assign_organization_role' assign course-user-roles except
for the organization against a course. CourseTeam role for the organization against a course.
""" """
self.assertFalse(self.course2.course_user_roles.all()) self.assertFalse(self.course2.course_user_roles.all())
...@@ -188,12 +188,18 @@ class CourseTests(TestCase): ...@@ -188,12 +188,18 @@ class CourseTests(TestCase):
role=PublisherUserRole.PartnerCoordinator, organization=self.org_extension_2.organization role=PublisherUserRole.PartnerCoordinator, organization=self.org_extension_2.organization
) )
factories.OrganizationUserRoleFactory( factories.OrganizationUserRoleFactory(
role=PublisherUserRole.PartnerCoordinator, organization=self.org_extension_2.organization role=PublisherUserRole.MarketingReviewer, organization=self.org_extension_2.organization
)
factories.OrganizationUserRoleFactory(
role=PublisherUserRole.CourseTeam, organization=self.org_extension_2.organization
) )
self.course2.assign_organization_role(self.org_extension_2.organization) self.course2.assign_organization_role(self.org_extension_2.organization)
self.assertEqual(len(self.course2.course_user_roles.all()), 2) self.assertEqual(len(self.course2.course_user_roles.all()), 2)
self.assertNotIn(PublisherUserRole.CourseTeam, self.course2.course_user_roles.all())
def test_assign_roles_without_default_roles(self): def test_assign_roles_without_default_roles(self):
""" """
Verify that method `assign_organization_role' works fine even if no Verify that method `assign_organization_role' works fine even if no
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment