diff options
author | adityacp | 2017-08-17 10:50:52 +0530 |
---|---|---|
committer | adityacp | 2017-08-17 10:50:52 +0530 |
commit | 30bd1c36a4abea6c6afea3a52d3a84d335c5673a (patch) | |
tree | 95b5d438cd3c4b409ee96d090142cbe73ba4279f /yaksh | |
parent | 4f305d1e2ccce8b2250624838a29d2000d0d9230 (diff) | |
download | online_test-30bd1c36a4abea6c6afea3a52d3a84d335c5673a.tar.gz online_test-30bd1c36a4abea6c6afea3a52d3a84d335c5673a.tar.bz2 online_test-30bd1c36a4abea6c6afea3a52d3a84d335c5673a.zip |
Change test_views.py
- Remove validation test case for send mail
- Pep8 changes
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/test_views.py | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py index 3c5b0dd..763f5ff 100644 --- a/yaksh/test_views.py +++ b/yaksh/test_views.py @@ -1869,16 +1869,19 @@ class TestCourseDetail(TestCase): user_ids = [self.student.id, self.student2.id, self.student3.id, self.student4.id] user_emails = [self.student.email, self.student2.email, - self.student3.email, self.student4.email] + self.student3.email, self.student4.email] self.user1_course.students.add(*user_ids) attachment = SimpleUploadedFile("file.txt", b"Test") - 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', - 'check': user_ids} - ) + email_data = { + 'send_mail': 'send_mail', 'email_attach': [attachment], + 'subject': 'test_bulk_mail', 'body': 'Test_Mail', + 'check': user_ids + } + self.client.post(reverse( + 'yaksh:send_mail', kwargs={'course_id': self.user1_course.id}), + data=email_data + ) attachment_file = mail.outbox[0].attachments[0][0] subject = mail.outbox[0].subject body = mail.outbox[0].alternatives[0][0] @@ -1889,18 +1892,12 @@ class TestCourseDetail(TestCase): 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']) + get_response = self.client.get(reverse( + 'yaksh:send_mail', kwargs={'course_id': self.user1_course.id}) + ) + self.assertEqual(get_response.status_code, 200) + self.assertEqual(get_response.context['course'], self.user1_course) + self.assertEqual(get_response.context['status'], 'mail') class TestEnrollRequest(TestCase): |