Exemple #1
0
 def setUp(self):
     self.asker = VendorFactory.create(email='*****@*****.**')
     super(TestOpportunityQuestions, self).setUp()
     self.q1 = QuestionFactory.create(opportunity=self.opportunity3, asked_by=self.asker)
     QuestionFactory.create(answer_text='an answer', opportunity=self.opportunity3)
     self.opportunity3.created_by = self.staff
     self.opportunity3.save()
     self.answer_url = '/beacon/admin/opportunities/{}/questions/{}'.format(self.opportunity3.id, self.q1.id)
     self.question_url = '/beacon/admin/opportunities/{}/questions'.format(self.opportunity3.id)
Exemple #2
0
 def test_new_questions_disabled_when_qa_disabled(self):
     QuestionFactory.create(
         question_text="wow look at this question",
         answer_text="wow look at this answer",
         opportunity=self.opportunity2,
     )
     opp = self.client.get("/opportunities/{}".format(self.opportunity2.id))
     self.assert200(opp)
     self.assertTrue("Questions" in opp.data)
     self.assertTrue("wow look at this question" in opp.data)
     self.assertTrue("wow look at this answer" in opp.data)
     self.assertTrue("Ask a question" not in opp.data)
Exemple #3
0
    def test_answered_questions_render(self):
        QuestionFactory.create(
            question_text="wow look at this question",
            answer_text="wow look at this answer",
            opportunity=self.opportunity3,
        ).save()
        QuestionFactory.create(
            question_text="this unanswered question will not render", opportunity=self.opportunity3
        ).save()

        opp = self.client.get(self.opportunity_url)
        self.assertTrue("wow look at this question" in opp.data)
        self.assertTrue("wow look at this answer" in opp.data)
        self.assertFalse("this unanswered question will not render" in opp.data)