oncall-engine/engine/common/tests/test_clean_markup.py
Michael Derynck 6b40f95033 World, meet OnCall!
Co-authored-by: Eve832 <eve.meelan@grafana.com>
    Co-authored-by: Francisco Montes de Oca <nevermind89x@gmail.com>
    Co-authored-by: Ildar Iskhakov <ildar.iskhakov@grafana.com>
    Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
    Co-authored-by: Julia <ferril.darkdiver@gmail.com>
    Co-authored-by: maskin25 <kengurek@gmail.com>
    Co-authored-by: Matias Bordese <mbordese@gmail.com>
    Co-authored-by: Matvey Kukuy <motakuk@gmail.com>
    Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
    Co-authored-by: Richard Hartmann <richih@richih.org>
    Co-authored-by: Robby Milo <robbymilo@fastmail.com>
    Co-authored-by: Timur Olzhabayev <timur.olzhabayev@grafana.com>
    Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
    Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
2022-06-03 08:09:47 -06:00

44 lines
1.1 KiB
Python

from common.utils import clean_markup
def test_clean_code_blocks_name():
original = "Tada! ```Tadada!``` `Tadadada!`"
expected = "Tada! Tadada! Tadadada!"
assert clean_markup(original) == expected
def test_clean_visual_basics():
original = "~Stroke~ *Bold* _Italic_ ~Word ~"
expected = "Stroke Bold Italic ~Word ~"
assert clean_markup(original) == expected
def test_clean_block_quotes():
original = (
"This is unquoted text\n"
"&gt; This is quoted text\n"
"&gt; This is still quoted text\n"
"This is unquoted text again"
)
expected = (
"This is unquoted text\n"
"> This is quoted text\n"
"> This is still quoted text\n"
"This is unquoted text again"
)
assert clean_markup(original) == expected
def test_clean_link():
original = "<http://www.foo.com>"
expected = "http://www.foo.com"
assert clean_markup(original) == expected
def test_clean_mailto():
# email
original = "<mailto:bob@example.com>"
expected = "bob@example.com"
assert clean_markup(original) == expected