Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
606ad7ab
Commit
606ad7ab
authored
Sep 30, 2014
by
Greg Price
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove dead code
parent
c51e504e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
52 deletions
+0
-52
common/djangoapps/course_groups/cohorts.py
+0
-21
common/djangoapps/course_groups/tests/test_cohorts.py
+0
-31
No files found.
common/djangoapps/course_groups/cohorts.py
View file @
606ad7ab
...
@@ -265,13 +265,6 @@ def add_cohort(course_key, name):
...
@@ -265,13 +265,6 @@ def add_cohort(course_key, name):
)
)
class
CohortConflict
(
Exception
):
"""
Raised when user to be added is already in another cohort in same course.
"""
pass
def
add_user_to_cohort
(
cohort
,
username_or_email
):
def
add_user_to_cohort
(
cohort
,
username_or_email
):
"""
"""
Look up the given user, and if successful, add them to the specified cohort.
Look up the given user, and if successful, add them to the specified cohort.
...
@@ -307,17 +300,3 @@ def add_user_to_cohort(cohort, username_or_email):
...
@@ -307,17 +300,3 @@ def add_user_to_cohort(cohort, username_or_email):
cohort
.
users
.
add
(
user
)
cohort
.
users
.
add
(
user
)
return
(
user
,
previous_cohort
)
return
(
user
,
previous_cohort
)
def
delete_empty_cohort
(
course_key
,
name
):
"""
Remove an empty cohort. Raise ValueError if cohort is not empty.
"""
cohort
=
get_cohort_by_name
(
course_key
,
name
)
if
cohort
.
users
.
exists
():
raise
ValueError
(
_
(
"You cannot delete non-empty cohort {cohort_name} in course {course_key}"
)
.
format
(
cohort_name
=
name
,
course_key
=
course_key
))
cohort
.
delete
()
common/djangoapps/course_groups/tests/test_cohorts.py
View file @
606ad7ab
...
@@ -408,34 +408,3 @@ class TestCohorts(django.test.TestCase):
...
@@ -408,34 +408,3 @@ class TestCohorts(django.test.TestCase):
User
.
DoesNotExist
,
User
.
DoesNotExist
,
lambda
:
cohorts
.
add_user_to_cohort
(
first_cohort
,
"non_existent_username"
)
lambda
:
cohorts
.
add_user_to_cohort
(
first_cohort
,
"non_existent_username"
)
)
)
def
test_delete_empty_cohort
(
self
):
"""
Make sure that cohorts.delete_empty_cohort() properly removes an empty cohort
for a given course.
"""
course
=
modulestore
()
.
get_course
(
self
.
toy_course_key
)
user
=
UserFactory
(
username
=
"Username"
,
email
=
"a@b.com"
)
empty_cohort
=
CohortFactory
(
course_id
=
course
.
id
,
name
=
"EmptyCohort"
)
nonempty_cohort
=
CohortFactory
(
course_id
=
course
.
id
,
name
=
"NonemptyCohort"
)
nonempty_cohort
.
users
.
add
(
user
)
cohorts
.
delete_empty_cohort
(
course
.
id
,
"EmptyCohort"
)
# Make sure we cannot access the deleted cohort
self
.
assertRaises
(
CourseUserGroup
.
DoesNotExist
,
lambda
:
cohorts
.
get_cohort_by_id
(
course
.
id
,
empty_cohort
.
id
)
)
self
.
assertRaises
(
ValueError
,
lambda
:
cohorts
.
delete_empty_cohort
(
course
.
id
,
"NonemptyCohort"
)
)
self
.
assertRaises
(
CourseUserGroup
.
DoesNotExist
,
lambda
:
cohorts
.
delete_empty_cohort
(
SlashSeparatedCourseKey
(
'course'
,
'does_not'
,
'exist'
),
"EmptyCohort"
)
)
self
.
assertRaises
(
CourseUserGroup
.
DoesNotExist
,
lambda
:
cohorts
.
delete_empty_cohort
(
course
.
id
,
"NonExistentCohort"
)
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment