示例#1
0
def test_handle_delete_key_exists():
    key, value = 'TEST', 1
    handle_put(key, value)
    operation_status, msg = handle_delete(key)

    assert operation_status is True
    assert msg == "Key [TEST] deleted"
示例#2
0
def test_handle_append_key_is_not_list():
    key, value = 'TEST', 'ONE'
    handle_put(key, value)
    operation_status, msg = handle_append(key, 1)

    assert operation_status is False
    assert msg == "ERROR: Key [TEST] contains non-list value ([1])"

    handle_delete(key)
示例#3
0
def test_handle_get_key_exists():
    key, value = 'TEST', 1
    handle_put(key, value)
    operation_status, p_value = handle_get(key)

    assert operation_status is True
    assert value == p_value

    handle_delete(key)
def test_handle_increment_key_is_not_int():
    key, value = 'TEST', 'ONE'
    handle_put(key, value)
    operation_status, msg = handle_increment(key)

    assert operation_status is False
    assert msg == "ERROR: Key [TEST] contains non-int value ([ONE])"

    handle_delete(key)
示例#5
0
def test_handle_append_success():
    key, value = 'TEST', [1, 2, 3, 4]
    handle_put(key, value)
    operation_status, msg = handle_append(key, 5)
    value = handle_get(key)

    assert operation_status is True
    assert msg, "Key [TEST] had value [5] appended"
    assert value[1] == [1, 2, 3, 4, 5]

    handle_delete(key)
def test_handle_increment_success():
    key, value = 'TEST', 1
    handle_put(key, value)
    operation_status, msg = handle_increment(key)
    return_value = handle_get(key)

    assert operation_status is True
    assert msg == "Key [TEST] incremented"
    assert return_value[1] == value + 1

    handle_delete(key)