summaryrefslogtreecommitdiff
path: root/yaksh/test_models.py
diff options
context:
space:
mode:
authorankitjavalkar2020-10-08 16:12:01 +0530
committerGitHub2020-10-08 16:12:01 +0530
commitaaf8f36bce5fff6c36bcbac3fa038ae99304b73f (patch)
treeb00c763f1ef38a3abf43f4f337d97f67ae04337a /yaksh/test_models.py
parentf61351f6a4e7a6150e66ca39f23ac14f9a60de96 (diff)
parent78eb6dc42e73551c2bb9972e53a2d7dd3b81e7d7 (diff)
downloadonline_test-aaf8f36bce5fff6c36bcbac3fa038ae99304b73f.tar.gz
online_test-aaf8f36bce5fff6c36bcbac3fa038ae99304b73f.tar.bz2
online_test-aaf8f36bce5fff6c36bcbac3fa038ae99304b73f.zip
Merge pull request #778 from ankitjavalkar/cruise-comments-under-video
[Rebased] Comments under video lesson
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r--yaksh/test_models.py51
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()