Beispiel #1
0
def test_message_store_case_insensitive(tmp_file):
    ms = MessageStore(lambda: tmp_file)

    a = ms.get_messages('target1')
    assert a == []

    ms.add_message('author', 'tArget1', 'text1')
    ms.add_message('author', 'taRget1', 'text2')

    a = ms.get_messages('TaRget1')
    assert len(a) == 2
Beispiel #2
0
def test_message_store_ordering(tmp_file):
    ms = MessageStore(lambda: tmp_file)

    a = ms.get_messages('target1')
    assert a == []

    ms.add_message('author', 'target1', 'text1')
    ms.add_message('author', 'target1', 'text2')

    a = ms.get_messages('target1')
    assert len(a) == 2
    assert a[0]['message'] == 'text1'
    assert a[1]['message'] == 'text2'
Beispiel #3
0
def test_message_store(tmp_file):
    ms = MessageStore(lambda: tmp_file)

    a = ms.get_messages('target1')
    assert a == []

    ms.add_message('author', 'target1', 'text1')
    ms.add_message('author', 'target1', 'text2')
    ms.add_message('author', 'target2', 'text')

    a = ms.get_messages('target1')
    assert len(a) == 2

    a = ms.get_messages('target2')
    assert len(a) == 1
Beispiel #4
0
def test_message_store(tmp_file):
    ms = MessageStore(lambda: tmp_file)

    a = ms.get_messages('target1')
    assert a == []

    ms.add_message('author', 'target1', 'text1')
    ms.add_message('author', 'target1', 'text2')
    ms.add_message('author', 'target2', 'text')

    a = ms.get_messages('target1')
    assert len(a) == 2

    a = ms.get_messages('target2')
    assert len(a) == 1
Beispiel #5
0
def test_message_store_case_insensitive(tmp_file):
    ms = MessageStore(lambda: tmp_file)

    a = ms.get_messages('target1')
    assert a == []

    ms.add_message('author', 'tArget1', 'text1')
    ms.add_message('author', 'taRget1', 'text2')

    a = ms.get_messages('TaRget1')
    assert len(a) == 2
Beispiel #6
0
def test_message_store_ordering(tmp_file):
    ms = MessageStore(lambda: tmp_file)

    a = ms.get_messages('target1')
    assert a == []

    ms.add_message('author', 'target1', 'text1')
    ms.add_message('author', 'target1', 'text2')

    a = ms.get_messages('target1')
    assert len(a) == 2
    assert a[0]['message'] == 'text1'
    assert a[1]['message'] == 'text2'
Beispiel #7
0
def test_duplicate(tmp_file):
    ms = MessageStore(lambda: tmp_file)
    ms.add_message('author', 'target', 'text')
    ms.add_message('author', 'target', 'text')
    assert len(ms._msg_store) == 1
Beispiel #8
0
def test_duplicate(tmp_file):
    ms = MessageStore(lambda: tmp_file)
    ms.add_message('author', 'target', 'text')
    ms.add_message('author', 'target', 'text')
    assert len(ms._msg_store) == 1