Beispiel #1
0
    def test_raise_value_error_with_invalid_text_type(self):
        text_val = "test"
        text_type = "InvalidType"

        with self.assertRaises(ValueError) as exc:
            get_text_content(primary_text=text_val, primary_text_type=text_type)

        assert "Invalid type provided" in str(exc.exception), \
            "get_text_content helper didn't raise ValueError when an " \
            "invalid type has been passed"
    def test_build_tertiary_text_default(self):
        text_val = "test"

        plain_text = PlainText(text=text_val)
        text_content = TextContent(tertiary_text=plain_text)

        assert get_text_content(tertiary_text=text_val) == text_content, \
            "get_text_content helper returned wrong text content with " \
            "tertiary text and default type"
    def test_build_tertiary_text_rich(self):
        text_val = "test"

        plain_text = RichText(text=text_val)
        text_content = TextContent(tertiary_text=plain_text)

        assert get_text_content(
            tertiary_text=text_val, tertiary_text_type=RICH_TEXT_TYPE) == text_content, \
            "get_text_content helper returned wrong text content with " \
            "tertiary text and rich type"