test_markdown.py 700 B

12345678910111213141516171819202122232425262728293031
  1. import unittest
  2. from fixtures.schema_validation import invalid_schema
  3. from sentry.api.validators.sentry_apps.schema import validate_component
  4. class TestMarkdownSchemaValidation(unittest.TestCase):
  5. def setUp(self):
  6. self.schema = {
  7. "type": "markdown",
  8. "text": """
  9. # This Is a Title
  10. - this
  11. - is
  12. - a
  13. - list
  14. """,
  15. }
  16. def test_valid_schema(self):
  17. validate_component(self.schema)
  18. @invalid_schema
  19. def test_missing_text(self):
  20. del self.schema["text"]
  21. validate_component(self.schema)
  22. @invalid_schema
  23. def test_invalid_text_type(self):
  24. self.schema["text"] = 1
  25. validate_component(self.schema)