def test_handle_increment_key_does_not_exists():
    key = 'TEST'
    operation_status, msg = handle_increment(key)

    assert operation_status is False
    assert msg == "ERROR: Key [TEST] does not exists"

    handle_delete(key)
def test_handle_append_key_does_not_exists():
    key, value = 'TEST', 5
    operation_status, msg = handle_append(key, value)

    assert operation_status is False
    assert msg == "ERROR: Key [TEST] does not exists"

    handle_delete(key)
def test_handle_get_put_list():
    key, value = 'TEST', [1, 2, 3, 4, 5]
    handle_putlist(key, value)
    operation_status, p_value = handle_getlist(key)

    assert operation_status is True
    assert value == p_value

    handle_delete(key)
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)
Example #5
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)
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)
Example #9
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"
Example #10
0
def test_handle_delete_key_does_not_exists():
    key = 'TEST'
    operation_status, msg = handle_delete(key)

    assert operation_status is False
    assert msg == "ERROR: Key [TEST] not found and could not be deleted"