Exemplo n.º 1
0
def test_text_setter_renders_markdown(markdown):
    markdown.render.return_value = "<p>foobar</p>"

    annotation = Annotation()
    annotation.text = "foobar"

    markdown.render.assert_called_once_with("foobar")

    annotation.text_rendered == markdown.render.return_value
Exemplo n.º 2
0
def test_text_setter_renders_markdown(markdown):
    markdown.render.return_value = "<p>foobar</p>"

    annotation = Annotation()
    annotation.text = "foobar"

    markdown.render.assert_called_once_with("foobar")

    annotation.text_rendered == markdown.render.return_value
Exemplo n.º 3
0
def test_thread_root_id_returns_first_reference_if_many_references():
    annotation = Annotation(
        id="uK9yVjoHEea6hsewWuiKtQ",
        references=[
            "1Ife3DoHEea6hpv8vWujdQ",
            "uVuItjoHEea6hiNgv1wvmg",
            "Qe7fpc5ZRgWy0RSHEP9UNg",
        ],
    )

    assert annotation.thread_root_id == "1Ife3DoHEea6hpv8vWujdQ"
Exemplo n.º 4
0
def test_authority_when_annotation_has_no_userid():
    assert Annotation().authority is None
Exemplo n.º 5
0
def test_parent_id_of_direct_reply():
    ann = Annotation(references=["parent_id"])

    assert ann.parent_id == "parent_id"
Exemplo n.º 6
0
def test_thread_root_id_returns_id_if_references_empty():
    annotation = Annotation(id="jANlljoHEea6hsv8FY7ipw", references=[])

    assert annotation.thread_root_id == "jANlljoHEea6hsv8FY7ipw"
Exemplo n.º 7
0
def test_thread_root_id_returns_reference_if_only_one_reference():
    annotation = Annotation(id="qvJnIjoHEea6hiv0nJK7gw",
                            references=["yiSVIDoHEea6hjcSFuROLw"])

    assert annotation.thread_root_id == "yiSVIDoHEea6hjcSFuROLw"
Exemplo n.º 8
0
def test_thread_root_id_returns_id_if_no_references():
    annotation = Annotation(id="GBhy1DoHEea6htPothzqZQ")

    assert annotation.thread_root_id == "GBhy1DoHEea6htPothzqZQ"
Exemplo n.º 9
0
def test_parent_id_of_annotation():
    ann = Annotation()

    assert ann.parent_id is None
Exemplo n.º 10
0
def test_non_reply_is_not_reply():
    ann = Annotation()

    assert ann.is_reply is False
Exemplo n.º 11
0
def test_reply_is_reply():
    ann = Annotation(references=["parent_id"])

    assert ann.is_reply is True
Exemplo n.º 12
0
def test_parent_id_of_reply_to_reply():
    ann = Annotation(references=["reply1", "reply2", "parent_id"])

    assert ann.parent_id == "parent_id"