Commit 66f52ba6 by Ayub-khan

-fixed Tests.

parent 9e3f68c0
...@@ -7,10 +7,12 @@ from contentstore.tests.utils import CourseTestCase ...@@ -7,10 +7,12 @@ from contentstore.tests.utils import CourseTestCase
from contentstore.utils import reverse_course_url from contentstore.utils import reverse_course_url
from xmodule.x_module import STUDENT_VIEW from xmodule.x_module import STUDENT_VIEW
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from django.test.client import RequestFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.tabs import CourseTabList from xmodule.tabs import CourseTabList
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from django.http import Http404 from django.http import Http404
from contentstore.views.tabs import tabs_handler
class TabsPageTests(CourseTestCase): class TabsPageTests(CourseTestCase):
...@@ -194,9 +196,11 @@ class TabsPageTests(CourseTestCase): ...@@ -194,9 +196,11 @@ class TabsPageTests(CourseTestCase):
def test_invalid_course_id(self): def test_invalid_course_id(self):
""" Asserts that Http404 is raised when the course id is not valid. """ """ Asserts that Http404 is raised when the course id is not valid. """
invalid_tab_url = reverse_course_url('tabs_handler', "/some.invalid.key/course-v1:TTT+CS01+2015_T0") request_factory = RequestFactory()
request = request_factory.get('/dummy-url')
request.user = self.user
with self.assertRaises(Http404): with self.assertRaises(Http404):
self.client.get(invalid_tab_url) tabs_handler(request, "/some.invalid.key/course-v1:TTT+CS01+2015_T0")
class PrimitiveTabEdit(ModuleStoreTestCase): class PrimitiveTabEdit(ModuleStoreTestCase):
......
...@@ -10,6 +10,8 @@ from student.models import CourseEnrollment ...@@ -10,6 +10,8 @@ from student.models import CourseEnrollment
from student.roles import CourseStaffRole, CourseInstructorRole from student.roles import CourseStaffRole, CourseInstructorRole
from student import auth from student import auth
from django.http import Http404 from django.http import Http404
from contentstore.views.user import course_team_handler
from django.test.client import RequestFactory
class UsersTestCase(CourseTestCase): class UsersTestCase(CourseTestCase):
...@@ -319,9 +321,8 @@ class UsersTestCase(CourseTestCase): ...@@ -319,9 +321,8 @@ class UsersTestCase(CourseTestCase):
def test_invalid_course_id(self): def test_invalid_course_id(self):
""" Asserts that Http404 is raised when the course id is not valid. """ """ Asserts that Http404 is raised when the course id is not valid. """
wrong_url = reverse_course_url( request_factory = RequestFactory()
'course_team_handler', "/some.invalid.key/course-v1:TTT+CS01+2015_T0", request = request_factory.get('/dummy-url')
kwargs={'email': self.ext_user.email} request.user = self.user
)
with self.assertRaises(Http404): with self.assertRaises(Http404):
self.client.get(wrong_url) course_team_handler(request, "/some.invalid.key/course-v1:TTT+CS01+2015_T0")
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