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
Beispiel #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
Beispiel #3
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
Beispiel #4
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
Beispiel #5
0
def test_text_setter_renders_markdown(markdown_render):
    markdown_render.render.return_value = "<p>foobar</p>"

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

    markdown_render.render.assert_called_once_with("foobar")

    assert (  # pylint: disable=comparison-with-callable
        annotation.text_rendered == markdown_render.render.return_value)
Beispiel #6
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'
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"
def test_thread_root_id_returns_reference_if_only_one_reference():
    annotation = Annotation(id="qvJnIjoHEea6hiv0nJK7gw",
                            references=["yiSVIDoHEea6hjcSFuROLw"])

    assert annotation.thread_root_id == "yiSVIDoHEea6hjcSFuROLw"
def test_thread_root_id_returns_id_if_references_empty():
    annotation = Annotation(id="jANlljoHEea6hsv8FY7ipw", references=[])

    assert annotation.thread_root_id == "jANlljoHEea6hsv8FY7ipw"
def test_thread_root_id_returns_id_if_no_references():
    annotation = Annotation(id="GBhy1DoHEea6htPothzqZQ")

    assert annotation.thread_root_id == "GBhy1DoHEea6htPothzqZQ"
def test_parent_id_of_annotation():
    ann = Annotation()

    assert ann.parent_id is None
def test_reply_is_reply():
    ann = Annotation(references=["parent_id"])

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

    assert ann.parent_id == "parent_id"
Beispiel #14
0
def test_parent_id_of_reply_to_reply():
    ann = Annotation(references=['reply1', 'reply2', 'parent_id'])

    assert ann.parent_id == 'parent_id'
def test_parent_id_of_direct_reply():
    ann = Annotation(references=["parent_id"])

    assert ann.parent_id == "parent_id"
def test_non_reply_is_not_reply():
    ann = Annotation()

    assert ann.is_reply is False
def test_authority_when_annotation_has_no_userid():
    assert Annotation().authority is None
Beispiel #18
0
def annotation(db_session):
    ann = Annotation(userid="testuser", target_uri="http://example.com")

    db_session.add(ann)
    db_session.flush()
    return ann