summaryrefslogtreecommitdiff
path: root/yaksh/test_models.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2017-05-05 17:45:41 +0530
committerGitHub2017-05-05 17:45:41 +0530
commit4cd448769c6cc230b7a33a1848cc45873b578468 (patch)
tree1bd9f9b020f988558b22cf406523ac2082558c7e /yaksh/test_models.py
parente56c50bb99a8694e8f1c8533df3f04e4613bcb08 (diff)
parente9d5de3d83d925921365f5574ce787a24abbd90c (diff)
downloadonline_test-4cd448769c6cc230b7a33a1848cc45873b578468.tar.gz
online_test-4cd448769c6cc230b7a33a1848cc45873b578468.tar.bz2
online_test-4cd448769c6cc230b7a33a1848cc45873b578468.zip
Merge pull request #288 from ankitjavalkar/course-clone
Add a negative test case to check attributes are duplicated
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r--yaksh/test_models.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py
index 5a61c0f..c86d9a3 100644
--- a/yaksh/test_models.py
+++ b/yaksh/test_models.py
@@ -8,6 +8,7 @@ from django.utils import timezone
import pytz
from django.contrib.auth.models import Group
from django.core.files import File
+from django.forms.models import model_to_dict
import zipfile
import os
import shutil
@@ -961,6 +962,17 @@ class CourseTestCases(unittest.TestCase):
self.template_course.end_enroll_time
)
+ # check if attributes are same
+ cloned_course_dict = model_to_dict(cloned_course,
+ fields=[field.name for field in cloned_course._meta.fields \
+ if field.name != 'id']
+ )
+ template_course_dict = model_to_dict(self.template_course,
+ fields=[field.name for field in self.template_course._meta.fields \
+ if field.name != 'id']
+ )
+ self.assertEqual(cloned_course_dict, template_course_dict)
+
# get duplicate quiz associated with duplicate course
cloned_quiz = cloned_course.quiz_set.all()[0]