Commit bbad9ae7 by wajeeha-khalid

MA-1182 - added test for not enrolled in course, removed commented out nose test…

MA-1182 - added test for not enrolled in course, removed commented out nose test code, formatted import statements according to edx standards
parent 4234ff59
...@@ -2912,6 +2912,12 @@ class RetrieveThreadTest( ...@@ -2912,6 +2912,12 @@ class RetrieveThreadTest(
self.assertEqual(get_thread(self.request, self.thread_id), expected_response_data) self.assertEqual(get_thread(self.request, self.thread_id), expected_response_data)
self.assertEqual(httpretty.last_request().method, "GET") self.assertEqual(httpretty.last_request().method, "GET")
def test_not_enrolled_in_course(self):
self.register_thread()
self.request.user = UserFactory.create()
with self.assertRaises(Http404):
get_thread(self.request, self.thread_id)
@ddt.data( @ddt.data(
*itertools.product( *itertools.product(
[ [
......
...@@ -588,7 +588,6 @@ class ThreadViewSetDeleteTest(DiscussionAPIViewTestMixin, ModuleStoreTestCase): ...@@ -588,7 +588,6 @@ class ThreadViewSetDeleteTest(DiscussionAPIViewTestMixin, ModuleStoreTestCase):
self.thread_id = "test_thread" self.thread_id = "test_thread"
def test_basic(self): def test_basic(self):
#from nose.tools import set_trace;set_trace()
self.register_get_user_response(self.user) self.register_get_user_response(self.user)
cs_thread = make_minimal_cs_thread({ cs_thread = make_minimal_cs_thread({
"id": self.thread_id, "id": self.thread_id,
...@@ -608,7 +607,6 @@ class ThreadViewSetDeleteTest(DiscussionAPIViewTestMixin, ModuleStoreTestCase): ...@@ -608,7 +607,6 @@ class ThreadViewSetDeleteTest(DiscussionAPIViewTestMixin, ModuleStoreTestCase):
self.assertEqual(httpretty.last_request().method, "DELETE") self.assertEqual(httpretty.last_request().method, "DELETE")
def test_delete_nonexistent_thread(self): def test_delete_nonexistent_thread(self):
#from nose.tools import set_trace;set_trace()
self.register_get_thread_error_response(self.thread_id, 404) self.register_get_thread_error_response(self.thread_id, 404)
response = self.client.delete(self.url) response = self.client.delete(self.url)
self.assertEqual(response.status_code, 404) self.assertEqual(response.status_code, 404)
......
...@@ -19,10 +19,11 @@ from discussion_api.api import ( ...@@ -19,10 +19,11 @@ from discussion_api.api import (
get_comment_list, get_comment_list,
get_course, get_course,
get_course_topics, get_course_topics,
get_thread,
get_thread_list, get_thread_list,
update_comment, update_comment,
update_thread, update_thread,
get_thread) )
from discussion_api.forms import CommentListGetForm, ThreadListGetForm from discussion_api.forms import CommentListGetForm, ThreadListGetForm
from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin
......
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