Exemplo n.º 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'
Exemplo n.º 2
0
def test_get():
    req_str = 'hello world'
    db_cla.set_req(req_str)

    result = db_cla.get_req('name')

    assert result == 'hello'
Exemplo n.º 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'
Exemplo n.º 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'
Exemplo n.º 5
0
def test_get():
    db_cla.set_req(['hello', 'world'])

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

    assert result == 'hello'