diff options
author | adityacp | 2017-06-12 18:23:17 +0530 |
---|---|---|
committer | adityacp | 2017-06-12 18:23:17 +0530 |
commit | a002ab59dbff856ee3838078cbe4f8fa439fd894 (patch) | |
tree | 9925d8aab16ecd80c57000151465f1f3d0302e25 /yaksh/test_views.py | |
parent | a7c9591eac66eb2751a2706b5686a997d7c236dd (diff) | |
download | online_test-a002ab59dbff856ee3838078cbe4f8fa439fd894.tar.gz online_test-a002ab59dbff856ee3838078cbe4f8fa439fd894.tar.bz2 online_test-a002ab59dbff856ee3838078cbe4f8fa439fd894.zip |
Change views tests to check send email
Diffstat (limited to 'yaksh/test_views.py')
-rw-r--r-- | yaksh/test_views.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py index 7018bd2..caec9d4 100644 --- a/yaksh/test_views.py +++ b/yaksh/test_views.py @@ -1108,7 +1108,7 @@ class TestCourseDetail(TestCase): self.user1_course.students.add(*user_ids) attachment = SimpleUploadedFile("file.txt", b"Test") - response = self.client.post(reverse('yaksh:reject_users', + response = self.client.post(reverse('yaksh:send_mail', kwargs={'course_id': self.user1_course.id}), data={'send_mail': 'send_mail', 'email_attach': [attachment], 'subject': 'test_bulk_mail', 'body': 'Test_Mail', @@ -1123,6 +1123,20 @@ class TestCourseDetail(TestCase): self.assertEqual(body, "Test_Mail") self.assertSequenceEqual(recipients, user_emails) + # Test for get request in send mail + get_response = self.client.get(reverse('yaksh:send_mail', + kwargs={'course_id': self.user1_course.id} + )) + self.assertEqual(response.status_code, 200) + self.assertEqual(response.context['course'], self.user1_course) + + # Test if no users are selected + post_response = self.client.post(reverse('yaksh:send_mail', + kwargs={'course_id': self.user1_course.id}), + data={'check': []} + ) + self.assertIn('select', post_response.context['message']) + class TestEnrollRequest(TestCase): def setUp(self): |