Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lms instructor api tests #3294

Merged
merged 1 commit into from
Apr 9, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions lms/djangoapps/instructor/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
"""
def setUp(self):
self.course = CourseFactory.create()
self.instructor = InstructorFactory(course=self.course.location)
self.instructor = InstructorFactory(course=self.course.id)
self.client.login(username=self.instructor.username, password='test')

self.beta_tester = BetaTesterFactory(course=self.course.location)
Expand All @@ -661,19 +661,19 @@ def setUp(self):

def test_missing_params(self):
""" Test missing all query parameters. """
url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id})
url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id.to_deprecated_string()})
response = self.client.get(url)
self.assertEqual(response.status_code, 400)

def test_bad_action(self):
""" Test with an invalid action. """
action = 'robot-not-an-action'
url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id})
url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id.to_deprecated_string()})
response = self.client.get(url, {'emails': self.beta_tester.email, 'action': action})
self.assertEqual(response.status_code, 400)

def test_add_notenrolled(self):
url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id})
url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id.to_deprecated_string()})
response = self.client.get(url, {'emails': self.notenrolled_student.email, 'action': 'add', 'email_students': False})
self.assertEqual(response.status_code, 200)

Expand All @@ -697,7 +697,7 @@ def test_add_notenrolled(self):
self.assertEqual(len(mail.outbox), 0)

def test_add_notenrolled_with_email(self):
url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id})
url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id.to_deprecated_string()})
response = self.client.get(url, {'emails': self.notenrolled_student.email, 'action': 'add', 'email_students': True})
self.assertEqual(response.status_code, 200)

Expand Down Expand Up @@ -736,7 +736,7 @@ def test_add_notenrolled_with_email(self):

def test_enroll_with_email_not_registered(self):
# User doesn't exist
url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id})
url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id.to_deprecated_string()})
response = self.client.get(url, {'emails': self.notregistered_email, 'action': 'add', 'email_students': True})
self.assertEqual(response.status_code, 200)
# test the response data
Expand All @@ -757,7 +757,7 @@ def test_enroll_with_email_not_registered(self):
self.assertEqual(len(mail.outbox), 0)

def test_remove_without_email(self):
url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id})
url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id.to_deprecated_string()})
response = self.client.get(url, {'emails': self.beta_tester.email, 'action': 'remove', 'email_students': False})
self.assertEqual(response.status_code, 200)

Expand All @@ -781,7 +781,7 @@ def test_remove_without_email(self):
self.assertEqual(len(mail.outbox), 0)

def test_remove_with_email(self):
url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id})
url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id.to_deprecated_string()})
response = self.client.get(url, {'emails': self.beta_tester.email, 'action': 'remove', 'email_students': True})
self.assertEqual(response.status_code, 200)

Expand Down Expand Up @@ -993,7 +993,7 @@ def test_list_course_role_members_staff(self):

# check response content
expected = {
'course_id': self.course.id,
'course_id': self.course.id.to_deprecated_string(),
'staff': [
{
'username': self.other_staff.username,
Expand All @@ -1016,7 +1016,7 @@ def test_list_course_role_members_beta(self):

# check response content
expected = {
'course_id': self.course.id,
'course_id': self.course.id.to_deprecated_string(),
'beta': []
}
res_json = json.loads(response.content)
Expand Down