Beispiel #1
0
 def test_answers_can_be_100_words(self):
     answer = " ".join(["word"] * 100)
     with self.app.app_context():
         question = BriefClarificationQuestion(brief=self.brief,
                                               question="Why?",
                                               answer=answer)
         question.validate()
Beispiel #2
0
 def test_questions_can_be_100_words(self):
     question = " ".join(["word"] * 100)
     with self.app.app_context():
         question = BriefClarificationQuestion(brief=self.brief,
                                               question=question,
                                               answer="Because")
         question.validate()
Beispiel #3
0
    def test_answer_must_not_be_empty(self):
        with self.app.app_context(), pytest.raises(ValidationError) as e:
            question = BriefClarificationQuestion(brief=self.brief,
                                                  question="Why?",
                                                  answer="")
            question.validate()

        assert e.value.message["answer"] == "answer_required"
Beispiel #4
0
    def test_answer_must_not_be_more_than_5000_characters(self):
        long_answer = "a" * 5001
        with self.app.app_context(), pytest.raises(ValidationError) as e:
            question = BriefClarificationQuestion(brief=self.brief,
                                                  question="Why?",
                                                  answer=long_answer)
            question.validate()

        assert e.value.message["answer"] == "under_character_limit"
Beispiel #5
0
    def test_answers_must_not_be_more_than_100_words(self):
        long_answer = " ".join(["word"] * 101)
        with self.app.app_context(), pytest.raises(ValidationError) as e:
            question = BriefClarificationQuestion(brief=self.brief,
                                                  question="Why?",
                                                  answer=long_answer)
            question.validate()

        assert e.value.message["answer"] == "under_100_words"