예제 #1
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")
예제 #2
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")
예제 #3
0
def test_cleanDeletedEditedItems():
    rs.set(EDITED+"NotExisted", "fjslfs")
    rs.set(EDITED+"NTR", "BTR")
    rs.set(EDITED+"百合", "百合")

    update.cleanDeletedItemsByPrefix(EDITED)

    assert rs.get(EDITED+"NTR")
    assert rs.get(EDITED+"百合")
    assert not rs.get(EDITED+"NotExisted")
예제 #4
0
def test_cleanDeletedEditedItems():
    rs.set(EDITED + "NotExisted", "fjslfs")
    rs.set(EDITED + "NTR", "BTR")
    rs.set(EDITED + "百合", "百合")

    update.cleanDeletedItemsByPrefix(EDITED)

    assert rs.get(EDITED + "NTR")
    assert rs.get(EDITED + "百合")
    assert not rs.get(EDITED + "NotExisted")
예제 #5
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)
예제 #6
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)
예제 #7
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)
예제 #8
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)
예제 #9
0
파일: views.py 프로젝트: alphazw/moedj
def loginSina(request, user_type):
    rs.set("current_user_type", user_type)
    return redirect(authSinaUrl())
예제 #10
0
def loginSina(request, user_type):
    rs.set("current_user_type", user_type)
    return redirect(authSinaUrl())