Commit 13c01ec3 by Will Daly

Randomized instructor page tests

parent bf37d4a9
...@@ -469,10 +469,13 @@ class TestViewAuth(LoginEnrollmentTestCase): ...@@ -469,10 +469,13 @@ class TestViewAuth(LoginEnrollmentTestCase):
'student_id': get_user(self.student).id})) 'student_id': get_user(self.student).id}))
return urls return urls
# shouldn't be able to get to the instructor pages # Randomly sample an instructor page
for url in instructor_urls(self.toy) + instructor_urls(self.full): url = random.choice(instructor_urls(self.toy) +
print 'checking for 404 on {0}'.format(url) instructor_urls(self.full))
self.check_for_get_code(404, url)
# Shouldn't be able to get to the instructor pages
print 'checking for 404 on {0}'.format(url)
self.check_for_get_code(404, url)
# Make the instructor staff in the toy course # Make the instructor staff in the toy course
group_name = _course_staff_group_name(self.toy.location) group_name = _course_staff_group_name(self.toy.location)
...@@ -483,13 +486,13 @@ class TestViewAuth(LoginEnrollmentTestCase): ...@@ -483,13 +486,13 @@ class TestViewAuth(LoginEnrollmentTestCase):
self.login(self.instructor, self.password) self.login(self.instructor, self.password)
# Now should be able to get to the toy course, but not the full course # Now should be able to get to the toy course, but not the full course
for url in instructor_urls(self.toy): url = random.choice(instructor_urls(self.toy))
print 'checking for 200 on {0}'.format(url) print 'checking for 200 on {0}'.format(url)
self.check_for_get_code(200, url) self.check_for_get_code(200, url)
for url in instructor_urls(self.full): url = random.choice(instructor_urls(self.full))
print 'checking for 404 on {0}'.format(url) print 'checking for 404 on {0}'.format(url)
self.check_for_get_code(404, url) self.check_for_get_code(404, url)
# now also make the instructor staff # now also make the instructor staff
instructor = get_user(self.instructor) instructor = get_user(self.instructor)
...@@ -497,9 +500,10 @@ class TestViewAuth(LoginEnrollmentTestCase): ...@@ -497,9 +500,10 @@ class TestViewAuth(LoginEnrollmentTestCase):
instructor.save() instructor.save()
# and now should be able to load both # and now should be able to load both
for url in instructor_urls(self.toy) + instructor_urls(self.full): url = random.choice(instructor_urls(self.toy) +
print 'checking for 200 on {0}'.format(url) instructor_urls(self.full))
self.check_for_get_code(200, url) print 'checking for 200 on {0}'.format(url)
self.check_for_get_code(200, url)
def run_wrapped(self, test): def run_wrapped(self, test):
""" """
......
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