Example #1
0
def test_ttl():
    req_str = 'time live 4'
    db_cla.ttl_req(req_str)

    result1 = db_cla.get_req('time')
    assert result1 == 'live'

    time.sleep(4)
    result2 = db_cla.get_req('time')
    assert result2 == 'None'
Example #2
0
def test_get():
    req_str = 'hello world'
    db_cla.set_req(req_str)

    result = db_cla.get_req('name')

    assert result == 'hello'
Example #3
0
def test_del():
    db_cla.set_req(['python', 'code'])

    result1 = db_cla.del_req(['python'])
    result2 = db_cla.get_req(['python'])

    assert result1 == 'OK' and result2 == 'None'
Example #4
0
def test_del():
    req_str = 'python code'
    db_cla.set_req(req_str)

    result1 = db_cla.del_req('python')
    result2 = db_cla.get_req('python')

    assert result1 == 'OK' and result2 == 'None'
Example #5
0
def test_get():
    db_cla.set_req(['hello', 'world'])

    result = db_cla.get_req(['name'])

    assert result == 'hello'