mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-17 13:09:49 -04:00
Built py.test cases for convert_markdown_template
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
from datetime import datetime
|
||||
from functools import partial
|
||||
|
||||
|
||||
import pytest
|
||||
from flask import url_for
|
||||
from flask import url_for, Flask
|
||||
from freezegun import freeze_time
|
||||
|
||||
from app.formatters import (
|
||||
@@ -12,6 +13,13 @@ from app.formatters import (
|
||||
format_notification_status_as_url,
|
||||
format_number_in_pounds_as_currency,
|
||||
round_to_significant_figures,
|
||||
convert_markdown_template
|
||||
)
|
||||
|
||||
from tests.conftest import (
|
||||
fake_markdown_file,
|
||||
fake_jinja_template,
|
||||
notify_admin
|
||||
)
|
||||
|
||||
|
||||
@@ -166,3 +174,15 @@ def test_email_safe_return_dot_separated_email_domain(service_name, safe_email):
|
||||
def test_format_delta():
|
||||
naive_now_utc = datetime.utcnow().isoformat()
|
||||
assert format_delta(naive_now_utc) == "just now"
|
||||
|
||||
@pytest.mark.usefixtures("fake_jinja_template")
|
||||
def test_jinja_format(fake_jinja_template):
|
||||
app = Flask("app")
|
||||
with app.app_context():
|
||||
assert convert_markdown_template(fake_jinja_template, test=True) == "<p>True</p>"
|
||||
|
||||
@pytest.mark.usefixtures("fake_markdown_file")
|
||||
def test_markdown_format(fake_markdown_file):
|
||||
app = Flask("app")
|
||||
with app.app_context():
|
||||
assert convert_markdown_template(fake_markdown_file, test=True) == "<h1>Test</h1>"
|
||||
|
||||
@@ -3594,3 +3594,13 @@ def end_to_end_authenticated_context(browser):
|
||||
context = browser.new_context(storage_state=auth_state_path)
|
||||
|
||||
return context
|
||||
|
||||
@pytest.fixture()
|
||||
def fake_markdown_file():
|
||||
input = "#Test"
|
||||
return input
|
||||
|
||||
@pytest.fixture()
|
||||
def fake_jinja_template():
|
||||
input = "{% if True %}True{% endif %}"
|
||||
return input
|
||||
|
||||
Reference in New Issue
Block a user