Skip to content

Commit

Permalink
test: fix test to get message, add new test for markdown parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
alycejenni committed Nov 22, 2023
1 parent 5e08de4 commit 3f87994
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,33 @@
import pytest
from ckan.plugins import toolkit
from ckanext.status.lib.helpers import status_get_message
import markdown

TEST_MESSAGE = 'this is a test message'
MARKDOWN_TEST_MESSAGE = '_this_ is a test **message**'
HTML_TEST_MESSAGE = '<p><em>this</em> is a test <strong>message</strong></p>'


@pytest.mark.filterwarnings('ignore::sqlalchemy.exc.SADeprecationWarning')
@pytest.mark.ckan_config('ckan.plugins', 'status')
@pytest.mark.ckan_config('ckanext.status.message', TEST_MESSAGE)
@pytest.mark.ckan_config('ckanext.status.enable_html', False)
@pytest.mark.usefixtures('with_plugins')
def test_helper_gets_message_when_present():
message = status_get_message()
assert message == TEST_MESSAGE


@pytest.mark.filterwarnings('ignore::sqlalchemy.exc.SADeprecationWarning')
@pytest.mark.ckan_config('ckan.plugins', 'status')
@pytest.mark.ckan_config('ckanext.status.message', MARKDOWN_TEST_MESSAGE)
@pytest.mark.ckan_config('ckanext.status.enable_html', True)
@pytest.mark.usefixtures('with_plugins')
def test_helper_parses_markdown_message():
message = status_get_message()
assert message == HTML_TEST_MESSAGE


@pytest.mark.filterwarnings('ignore::sqlalchemy.exc.SADeprecationWarning')
@pytest.mark.ckan_config('ckan.plugins', 'status')
@pytest.mark.usefixtures('with_plugins')
Expand Down

0 comments on commit 3f87994

Please sign in to comment.