Exemplo n.º 1
0
 def test_get_related_object_type_name_for_answer_revision(self):
     question = self.post_question(user=self.u1)
     answer = self.post_answer(user=self.u1, question=question)
     revision = answer.revisions.all()[0]
     ct = ContentType.objects.get_for_model(revision)
     self.assertEqual('answer',
                      get_related_object_type_name(ct.id, revision.id))
Exemplo n.º 2
0
 def test_get_related_object_type_name_for_anything_else_2(self):
     question = self.post_question(user=self.u1)
     comment = self.post_comment(user=self.u1, parent_post=question)
     ct = ContentType.objects.get_for_model(comment)
     self.assertTrue(
         get_related_object_type_name(ct.id, comment.id) is None
     )
Exemplo n.º 3
0
 def test_get_related_object_type_name_for_anything_else_2(self):
     question = self.post_question(user=self.u1)
     comment = self.post_comment(user=self.u1, parent_post=question)
     ct = ContentType.objects.get_for_model(comment)
     self.assertTrue(
         get_related_object_type_name(ct.id, comment.id) is None)
Exemplo n.º 4
0
 def test_get_related_object_type_name_for_anything_else_1(self):
     ct = ContentType.objects.get_for_model(self.u2)
     self.assertTrue(
         get_related_object_type_name(ct.id, self.u2.id) is None)
Exemplo n.º 5
0
 def test_get_related_object_type_name_for_answer(self):
     question = self.post_question(user=self.u1)
     answer = self.post_answer(user=self.u1, question=question)
     ct = ContentType.objects.get_for_model(answer)
     self.assertEqual('answer',
                      get_related_object_type_name(ct.id, answer.id))
Exemplo n.º 6
0
 def test_get_related_object_type_name_for_question(self):
     question = self.post_question(user=self.u1)
     #import ipdb; ipdb.set_trace()
     ct = ContentType.objects.get_for_model(question)
     self.assertEqual('question',
                      get_related_object_type_name(ct.id, question.id))
Exemplo n.º 7
0
 def test_get_related_object_type_name_for_anything_else_1(self):
     ct = ContentType.objects.get_for_model(self.u2)
     self.assertTrue(
         get_related_object_type_name(ct.id, self.u2.id) is None
     )
Exemplo n.º 8
0
 def test_get_related_object_type_name_for_answer_revision(self):
     question = self.post_question(user=self.u1)
     answer = self.post_answer(user=self.u1, question=question)
     revision = answer.revisions.all()[0]
     ct = ContentType.objects.get_for_model(revision)
     self.assertEqual('answer', get_related_object_type_name(ct.id, revision.id))
Exemplo n.º 9
0
 def test_get_related_object_type_name_for_answer(self):
     question = self.post_question(user=self.u1)
     answer = self.post_answer(user=self.u1, question=question)
     ct = ContentType.objects.get_for_model(answer)
     self.assertEqual('answer', get_related_object_type_name(ct.id, answer.id))
Exemplo n.º 10
0
 def test_get_related_object_type_name_for_question(self):
     question = self.post_question(user=self.u1)
     #import ipdb; ipdb.set_trace()
     ct = ContentType.objects.get_for_model(question)
     self.assertEqual('question', get_related_object_type_name(ct.id, question.id))