Commit 39d9fdee by cahrens Committed by Andy Armstrong

Stop using to_deprecated_string.

parent 42c40718
...@@ -96,9 +96,9 @@ class CohortHandlerTestCase(CohortViewsTestCase): ...@@ -96,9 +96,9 @@ class CohortHandlerTestCase(CohortViewsTestCase):
request = RequestFactory().get("dummy_url") request = RequestFactory().get("dummy_url")
request.user = self.staff_user request.user = self.staff_user
if cohort: if cohort:
response = cohort_handler(request, course.id.to_deprecated_string(), cohort.id) response = cohort_handler(request, unicode(course.id), cohort.id)
else: else:
response = cohort_handler(request, course.id.to_deprecated_string()) response = cohort_handler(request, unicode(course.id))
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
return json.loads(response.content) return json.loads(response.content)
...@@ -113,9 +113,9 @@ class CohortHandlerTestCase(CohortViewsTestCase): ...@@ -113,9 +113,9 @@ class CohortHandlerTestCase(CohortViewsTestCase):
request = RequestFactory().put(path="dummy path", data=data, content_type="application/json") request = RequestFactory().put(path="dummy path", data=data, content_type="application/json")
request.user = self.staff_user request.user = self.staff_user
if cohort: if cohort:
response = cohort_handler(request, course.id.to_deprecated_string(), cohort.id) response = cohort_handler(request, unicode(course.id), cohort.id)
else: else:
response = cohort_handler(request, course.id.to_deprecated_string()) response = cohort_handler(request, unicode(course.id))
self.assertEqual(response.status_code, expected_response_code) self.assertEqual(response.status_code, expected_response_code)
return json.loads(response.content) return json.loads(response.content)
...@@ -157,9 +157,9 @@ class CohortHandlerTestCase(CohortViewsTestCase): ...@@ -157,9 +157,9 @@ class CohortHandlerTestCase(CohortViewsTestCase):
""" """
Verify that we cannot access cohort_handler if we're a non-staff user. Verify that we cannot access cohort_handler if we're a non-staff user.
""" """
self._verify_non_staff_cannot_access(cohort_handler, "GET", [self.course.id.to_deprecated_string()]) self._verify_non_staff_cannot_access(cohort_handler, "GET", [unicode(self.course.id)])
self._verify_non_staff_cannot_access(cohort_handler, "POST", [self.course.id.to_deprecated_string()]) self._verify_non_staff_cannot_access(cohort_handler, "POST", [unicode(self.course.id)])
self._verify_non_staff_cannot_access(cohort_handler, "PUT", [self.course.id.to_deprecated_string()]) self._verify_non_staff_cannot_access(cohort_handler, "PUT", [unicode(self.course.id)])
def test_no_cohorts(self): def test_no_cohorts(self):
""" """
...@@ -431,7 +431,7 @@ class UsersInCohortTestCase(CohortViewsTestCase): ...@@ -431,7 +431,7 @@ class UsersInCohortTestCase(CohortViewsTestCase):
""" """
request = RequestFactory().get("dummy_url", {"page": requested_page}) request = RequestFactory().get("dummy_url", {"page": requested_page})
request.user = self.staff_user request.user = self.staff_user
response = users_in_cohort(request, course.id.to_deprecated_string(), cohort.id) response = users_in_cohort(request, unicode(course.id), cohort.id)
if should_return_bad_request: if should_return_bad_request:
self.assertEqual(response.status_code, 400) self.assertEqual(response.status_code, 400)
...@@ -461,7 +461,7 @@ class UsersInCohortTestCase(CohortViewsTestCase): ...@@ -461,7 +461,7 @@ class UsersInCohortTestCase(CohortViewsTestCase):
Verify that non-staff users cannot access `check_users_in_cohort`. Verify that non-staff users cannot access `check_users_in_cohort`.
""" """
cohort = CohortFactory(course_id=self.course.id, users=[]) cohort = CohortFactory(course_id=self.course.id, users=[])
self._verify_non_staff_cannot_access(users_in_cohort, "GET", [self.course.id.to_deprecated_string(), cohort.id]) self._verify_non_staff_cannot_access(users_in_cohort, "GET", [unicode(self.course.id), cohort.id])
def test_no_users(self): def test_no_users(self):
""" """
...@@ -570,10 +570,10 @@ class AddUsersToCohortTestCase(CohortViewsTestCase): ...@@ -570,10 +570,10 @@ class AddUsersToCohortTestCase(CohortViewsTestCase):
if should_raise_404: if should_raise_404:
self.assertRaises( self.assertRaises(
Http404, Http404,
lambda: add_users_to_cohort(request, course.id.to_deprecated_string(), cohort.id) lambda: add_users_to_cohort(request, unicode(course.id), cohort.id)
) )
else: else:
response = add_users_to_cohort(request, course.id.to_deprecated_string(), cohort.id) response = add_users_to_cohort(request, unicode(course.id), cohort.id)
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
return json.loads(response.content) return json.loads(response.content)
...@@ -632,7 +632,7 @@ class AddUsersToCohortTestCase(CohortViewsTestCase): ...@@ -632,7 +632,7 @@ class AddUsersToCohortTestCase(CohortViewsTestCase):
self._verify_non_staff_cannot_access( self._verify_non_staff_cannot_access(
add_users_to_cohort, add_users_to_cohort,
"POST", "POST",
[self.course.id.to_deprecated_string(), cohort.id] [unicode(self.course.id), cohort.id]
) )
def test_empty(self): def test_empty(self):
...@@ -863,7 +863,7 @@ class RemoveUserFromCohortTestCase(CohortViewsTestCase): ...@@ -863,7 +863,7 @@ class RemoveUserFromCohortTestCase(CohortViewsTestCase):
else: else:
request = RequestFactory().post("dummy_url") request = RequestFactory().post("dummy_url")
request.user = self.staff_user request.user = self.staff_user
response = remove_user_from_cohort(request, self.course.id.to_deprecated_string(), cohort.id) response = remove_user_from_cohort(request, unicode(self.course.id), cohort.id)
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
return json.loads(response.content) return json.loads(response.content)
...@@ -889,7 +889,7 @@ class RemoveUserFromCohortTestCase(CohortViewsTestCase): ...@@ -889,7 +889,7 @@ class RemoveUserFromCohortTestCase(CohortViewsTestCase):
self._verify_non_staff_cannot_access( self._verify_non_staff_cannot_access(
remove_user_from_cohort, remove_user_from_cohort,
"POST", "POST",
[self.course.id.to_deprecated_string(), cohort.id] [unicode(self.course.id), cohort.id]
) )
def test_no_username_given(self): def test_no_username_given(self):
......
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