summaryrefslogtreecommitdiff
path: root/yaksh/test_models.py
diff options
context:
space:
mode:
authorCruiseDevice2020-04-22 18:26:44 +0530
committerCruiseDevice2020-04-22 18:26:44 +0530
commit3a01e7eb424a0eadfe27386db275682b9d5ca5bd (patch)
tree14e38c890b525f2dc5bc2ef3f81ae4651424cdc2 /yaksh/test_models.py
parent04b59bef46557f5e7a1230ab8e5a4929b48c5d59 (diff)
downloadonline_test-3a01e7eb424a0eadfe27386db275682b9d5ca5bd.tar.gz
online_test-3a01e7eb424a0eadfe27386db275682b9d5ca5bd.tar.bz2
online_test-3a01e7eb424a0eadfe27386db275682b9d5ca5bd.zip
More Tests
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r--yaksh/test_models.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py
index a57a61b..4e6b1ae 100644
--- a/yaksh/test_models.py
+++ b/yaksh/test_models.py
@@ -2320,3 +2320,47 @@ class PostModelTestCases(unittest.TestCase):
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() \ No newline at end of file