@@ -76,8 +76,10 @@ def test_add_user_not_authenticated(self):
76
76
"""
77
77
Tests that adding to creator group fails if user is not authenticated
78
78
"""
79
- with mock .patch .dict ('django.conf.settings.FEATURES' ,
80
- {'DISABLE_COURSE_CREATION' : False , "ENABLE_CREATOR_GROUP" : True }):
79
+ with mock .patch .dict (
80
+ 'django.conf.settings.FEATURES' ,
81
+ {'DISABLE_COURSE_CREATION' : False , "ENABLE_CREATOR_GROUP" : True }
82
+ ):
81
83
anonymous_user = AnonymousUser ()
82
84
role = CourseCreatorRole ()
83
85
add_users (self .admin , role , anonymous_user )
@@ -87,8 +89,10 @@ def test_add_user_not_active(self):
87
89
"""
88
90
Tests that adding to creator group fails if user is not active
89
91
"""
90
- with mock .patch .dict ('django.conf.settings.FEATURES' ,
91
- {'DISABLE_COURSE_CREATION' : False , "ENABLE_CREATOR_GROUP" : True }):
92
+ with mock .patch .dict (
93
+ 'django.conf.settings.FEATURES' ,
94
+ {'DISABLE_COURSE_CREATION' : False , "ENABLE_CREATOR_GROUP" : True }
95
+ ):
92
96
self .user .is_active = False
93
97
add_users (self .admin , CourseCreatorRole (), self .user )
94
98
self .assertFalse (has_access (self .user , CourseCreatorRole ()))
@@ -108,7 +112,7 @@ def test_add_user_to_group_requires_active(self):
108
112
109
113
def test_add_user_to_group_requires_authenticated (self ):
110
114
with self .assertRaises (PermissionDenied ):
111
- self .admin .is_authenticated = False
115
+ self .admin .is_authenticated = mock . Mock ( return_value = False )
112
116
add_users (self .admin , CourseCreatorRole (), self .user )
113
117
114
118
def test_remove_user_from_group_requires_staff_access (self ):
@@ -123,7 +127,7 @@ def test_remove_user_from_group_requires_active(self):
123
127
124
128
def test_remove_user_from_group_requires_authenticated (self ):
125
129
with self .assertRaises (PermissionDenied ):
126
- self .admin .is_authenticated = False
130
+ self .admin .is_authenticated = mock . Mock ( return_value = False )
127
131
remove_users (self .admin , CourseCreatorRole (), self .user )
128
132
129
133
0 commit comments