diff options
author | CruiseDevice | 2020-05-09 17:42:01 +0530 |
---|---|---|
committer | CruiseDevice | 2020-05-09 17:42:01 +0530 |
commit | 9a8330b74c9ee0ddf8720a7326a699ba32922575 (patch) | |
tree | 6c658831e0d326a6d4f546b35fec25964f61778e | |
parent | b36ea2af46cbf50aa7a046aa35d0c5c1543e6623 (diff) | |
download | online_test-9a8330b74c9ee0ddf8720a7326a699ba32922575.tar.gz online_test-9a8330b74c9ee0ddf8720a7326a699ba32922575.tar.bz2 online_test-9a8330b74c9ee0ddf8720a7326a699ba32922575.zip |
Fix pep8
- cover missing tests.
-rw-r--r-- | yaksh/test_views.py | 14 | ||||
-rw-r--r-- | yaksh/urls.py | 8 | ||||
-rw-r--r-- | yaksh/views.py | 12 |
3 files changed, 26 insertions, 8 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py index 555f933..583aaa9 100644 --- a/yaksh/test_views.py +++ b/yaksh/test_views.py @@ -3172,7 +3172,8 @@ class TestCourseDetail(TestCase): response = self.client.post(url) self.assertEqual(response.status_code, 302) - def test_enroll_reject_user_where_moderator_is_neither_creator_nor_teacher(self): + def test_enroll_reject_user_where_moderator_is_neither_creator_nor_teacher( + self): self.client.login( username=self.user2.username, password=self.user2_plaintext_pass @@ -3183,6 +3184,17 @@ class TestCourseDetail(TestCase): response = self.client.post(url) self.assertEqual(response.status_code, 404) + def test_get_enroll_reject_user_view(self): + self.client.login( + username=self.user1.username, + password=self.user1_plaintext_pass + ) + url = reverse('yaksh:enroll_reject_user', kwargs={ + 'course_id': self.user1_course.id, + }) + response = self.client.get(url) + self.assertEqual(response.status_code, 302) + def test_toggle_course_status_get(self): self.client.login( username=self.user1.username, diff --git a/yaksh/urls.py b/yaksh/urls.py index 97bd42e..88f34b3 100644 --- a/yaksh/urls.py +++ b/yaksh/urls.py @@ -122,9 +122,9 @@ urlpatterns = [ name='edit_course'), url(r'manage/course_detail/(?P<course_id>\d+)/$', views.course_detail, name='course_detail'), - + url(r'manage/enroll/(?P<course_id>\d+)/$', views.enroll_reject_user, - name="enroll_reject_user"), + name="enroll_reject_user"), url(r'manage/enroll/(?P<course_id>\d+)/(?P<user_id>\d+)/$', views.enroll_user, name="enroll_user"), url(r'manage/reject/(?P<course_id>\d+)/(?P<user_id>\d+)/$', @@ -146,14 +146,14 @@ urlpatterns = [ name="upload_users"), url(r'manage/send_mail/(?P<course_id>\d+)/$', views.send_mail, name="send_mail"), - + url(r'manage/toggle_status/(?P<course_id>\d+)/$', views.toggle_course_status, name="toggle_course_status"), url(r'^questions/filter$', views.questions_filter, name="questions_filter"), url(r'^editprofile/$', views.edit_profile, name='edit_profile'), url(r'^viewprofile/$', views.view_profile, name='view_profile'), - + url(r'^manage/searchteacher/(?P<course_id>\d+)/$', views.search_teacher, name="search_teacher"), url(r'^manage/addteacher/(?P<course_id>\d+)/$', views.add_teacher, diff --git a/yaksh/views.py b/yaksh/views.py index cde169f..44abcff 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -1190,8 +1190,9 @@ def enroll_reject_user(request, return redirect('yaksh:course_students', course_id=course_id) users = User.objects.filter(id__in=reject_ids) course.reject(was_enrolled, *users) - messages.success(request, "Rejected students successfully") + messages.success(request, "Rejected students successfully") return redirect('yaksh:course_students', course_id=course_id) + return redirect('yaksh:course_students', course_id=course_id) @login_required @@ -3242,8 +3243,13 @@ def course_students(request, course_id): enrolled_users = course.get_enrolled() requested_users = course.get_requests() rejected_users = course.get_rejected() - context = {"enrolled_users": enrolled_users, "requested_users": requested_users, "course": course, - "rejected_users": rejected_users, "is_students": True} + context = { + "enrolled_users": enrolled_users, + "requested_users": requested_users, + "course": course, + "rejected_users": rejected_users, + "is_students": True + } return my_render_to_response(request, 'yaksh/course_detail.html', context) |