diff options
author | CruiseDevice | 2020-09-10 20:11:53 +0530 |
---|---|---|
committer | ankitjavalkar | 2020-10-08 10:42:50 +0530 |
commit | 4d87a5eec1af36d32cc0daa4b6c1053a62712b7a (patch) | |
tree | e690061681d5308c1d3514aec6e599304275b102 /yaksh/test_models.py | |
parent | 9b2da6c6bb03239d0d72e674ec66be0880cadcbc (diff) | |
download | online_test-4d87a5eec1af36d32cc0daa4b6c1053a62712b7a.tar.gz online_test-4d87a5eec1af36d32cc0daa4b6c1053a62712b7a.tar.bz2 online_test-4d87a5eec1af36d32cc0daa4b6c1053a62712b7a.zip |
Fix breaking tests in test_models
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r-- | yaksh/test_models.py | 51 |
1 files changed, 3 insertions, 48 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py index cd8776b..67da7d1 100644 --- a/yaksh/test_models.py +++ b/yaksh/test_models.py @@ -1,5 +1,6 @@ import unittest from django.contrib.auth.models import Group +from django.contrib.contenttypes.models import ContentType from django.core.files.uploadedfile import SimpleUploadedFile from yaksh.models import User, Profile, Question, Quiz, QuestionPaper,\ QuestionSet, AnswerPaper, Answer, Course, StandardTestCase,\ @@ -2431,9 +2432,10 @@ class PostModelTestCases(unittest.TestCase): enrollment='Enroll Request', creator=self.user3 ) + course_ct = ContentType.objects.get_for_model(self.course) self.post1 = Post.objects.create( title='Post 1', - course=self.course, + target_ct=course_ct, target_id=self.course.id, creator=self.user1, description='Post 1 description' ) @@ -2456,56 +2458,9 @@ class PostModelTestCases(unittest.TestCase): count = self.post1.get_comments_count() self.assertEquals(count, 2) - def test__str__(self): - self.assertEquals(str(self.post1.title), self.post1.title) - def tearDown(self): self.user1.delete() self.user2.delete() self.user3.delete() self.course.delete() self.post1.delete() - - -class CommentModelTestCases(unittest.TestCase): - def setUp(self): - self.user1 = User.objects.create( - username='bart', - password='bart', - email='bart@test.com' - ) - Profile.objects.create( - user=self.user1, - roll_number=1, - institute='IIT', - department='Chemical', - position='Student' - ) - self.course = Course.objects.create( - name='Python Course', - enrollment='Enroll Request', - creator=self.user1 - ) - self.post1 = Post.objects.create( - title='Post 1', - course=self.course, - creator=self.user1, - description='Post 1 description' - ) - self.comment1 = Comment.objects.create( - post_field=self.post1, - creator=self.user1, - description='Post 1 comment 1' - ) - - def test__str__(self): - self.assertEquals( - str(self.comment1.post_field.title), - self.comment1.post_field.title - ) - - def tearDown(self): - self.user1.delete() - self.course.delete() - self.post1.delete() - self.comment1.delete() |