Exemplo n.º 1
0
def test_cleanDeletedNewItems():
    rs.set(NEWITEM+"NotExisted", "fjslfs")
    rs.set(NEWITEM+"NTR", "BTR")
    rs.set(NEWITEM+"百合", "百合")

    update.cleanDeletedItemsByPrefix(NEWITEM)

    assert rs.get(NEWITEM+"NTR")
    assert rs.get(NEWITEM+"百合")
    assert not rs.get(NEWITEM+"NotExisted")

    _deletePrefix(NEWITEM)
Exemplo n.º 2
0
def test_cleanDeletedNewItems():
    rs.set(NEWITEM + "NotExisted", "fjslfs")
    rs.set(NEWITEM + "NTR", "BTR")
    rs.set(NEWITEM + "百合", "百合")

    update.cleanDeletedItemsByPrefix(NEWITEM)

    assert rs.get(NEWITEM + "NTR")
    assert rs.get(NEWITEM + "百合")
    assert not rs.get(NEWITEM + "NotExisted")

    _deletePrefix(NEWITEM)
Exemplo n.º 3
0
def test_filterExistedItems():
    _deletePrefix(NEWITEM)
    _deletePrefix(EDITED)
    rs.delete(VERIFYING_SET)

    rs.set(NEWITEM + "newitem", "newitem")
    rs.set(EDITED + "edited", "edited")
    rs.zadd(VERIFYING_SET, "verifying", 1)

    assert not update.filterExistedItems("newitem")
    assert not update.filterExistedItems("edited")
    assert not update.filterExistedItems("verifying")
    assert update.filterExistedItems("shouldnotexisted")

    rs.delete(NEWITEM + "newitem")
    rs.delete(EDITED + "edited")
    rs.zrem(VERIFYING_SET, "verifying")
Exemplo n.º 4
0
def test_filterExistedItems():
    _deletePrefix(NEWITEM)
    _deletePrefix(EDITED)
    rs.delete(VERIFYING_SET)


    rs.set(NEWITEM+"newitem", "newitem")
    rs.set(EDITED+"edited", "edited")
    rs.zadd(VERIFYING_SET, "verifying", 1)

    assert not update.filterExistedItems("newitem")
    assert not update.filterExistedItems("edited")
    assert not update.filterExistedItems("verifying")
    assert update.filterExistedItems("shouldnotexisted")

    rs.delete(NEWITEM+"newitem")
    rs.delete(EDITED+"edited")
    rs.zrem(VERIFYING_SET, "verifying")
Exemplo n.º 5
0
def test_getItemTobeSend():
    # 0. test no item exist in either side
    _deletePrefix(EDITED)
    _deletePrefix(NEWITEM)
    result = update.getItemTobeSend()
    assert not (result[1])

    # 1. test when new items not exist, edited item exist
    rs.set(EDITED+"百合", "百合")
    rs.set(EDITED+"佐天泪子", "佐天泪子")
    assert update.getItemTobeSend()[1] in [EDITED+"百合", EDITED+"佐天泪子"]

    # 2. test when new items exist but is deleted
    rs.set(NEWITEM+"newitem1", "newitem1")
    rs.set(NEWITEM+"newitem2", "newitem2")
    assert update.getItemTobeSend()[1] in [EDITED+"佐天泪子", EDITED+"百合"]

    # 3. test when new items existed and existed in mb web pages
    rs.set(NEWITEM+"NTR", "NTR")
    rs.set(NEWITEM+"百合", "百合")
    assert update.getItemTobeSend()[1] in [NEWITEM+"NTR", NEWITEM+"百合"]

    _deletePrefix(EDITED)
    _deletePrefix(NEWITEM)
Exemplo n.º 6
0
def test_getItemTobeSend():
    # 0. test no item exist in either side
    _deletePrefix(EDITED)
    _deletePrefix(NEWITEM)
    result = update.getItemTobeSend()
    assert not (result[1])

    # 1. test when new items not exist, edited item exist
    rs.set(EDITED + "百合", "百合")
    rs.set(EDITED + "佐天泪子", "佐天泪子")
    assert update.getItemTobeSend()[1] in [EDITED + "百合", EDITED + "佐天泪子"]

    # 2. test when new items exist but is deleted
    rs.set(NEWITEM + "newitem1", "newitem1")
    rs.set(NEWITEM + "newitem2", "newitem2")
    assert update.getItemTobeSend()[1] in [EDITED + "佐天泪子", EDITED + "百合"]

    # 3. test when new items existed and existed in mb web pages
    rs.set(NEWITEM + "NTR", "NTR")
    rs.set(NEWITEM + "百合", "百合")
    assert update.getItemTobeSend()[1] in [NEWITEM + "NTR", NEWITEM + "百合"]

    _deletePrefix(EDITED)
    _deletePrefix(NEWITEM)