diff options
author | mahesh | 2018-01-30 15:02:55 +0530 |
---|---|---|
committer | mahesh | 2018-01-30 16:46:41 +0530 |
commit | 782fd83b5931efde8ae26795c65e952df5012d0f (patch) | |
tree | 758881fc7e31709bb5c1e63d42b3bc0a043cf087 /yaksh/test_models.py | |
parent | a4bf74684bcb32e461defc36e48ba71bf7f02c03 (diff) | |
download | online_test-782fd83b5931efde8ae26795c65e952df5012d0f.tar.gz online_test-782fd83b5931efde8ae26795c65e952df5012d0f.tar.bz2 online_test-782fd83b5931efde8ae26795c65e952df5012d0f.zip |
Add test cases to check for duplicate answerpapers
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r-- | yaksh/test_models.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py index 7086a1e..9166a3e 100644 --- a/yaksh/test_models.py +++ b/yaksh/test_models.py @@ -12,6 +12,7 @@ from datetime import datetime, timedelta from django.utils import timezone import pytz from django.contrib.auth.models import Group +from django.db import IntegrityError from django.core.files import File from django.forms.models import model_to_dict from textwrap import dedent @@ -1313,6 +1314,16 @@ class AnswerPaperTestCases(unittest.TestCase): self.assertEqual(self.user2_answerpaper2.current_question(), self.question1) + def test_duplicate_attempt_answerpaper(self): + with self.assertRaises(IntegrityError): + new_answerpaper = AnswerPaper.objects.create( + user=self.answerpaper.user, + question_paper=self.answerpaper.question_paper, + attempt_number=self.answerpaper.attempt_number, + start_time=self.answerpaper.start_time, + end_time=self.answerpaper.end_time + ) + ############################################################################### class CourseTestCases(unittest.TestCase): |