Ejemplo n.º 1
0
def test_request_find():
    r = RequestReference(host=TESTING_CONFIG['host'],
                        port=TESTING_CONFIG['port'])
    req_dict = dict(sample='hidefix', time=time.time(),
                    uid=str(uuid4()), state='active', seq_num=0, foo='bar',
                    hero='obelix', antihero='romans')
    inserted = r.create(**req_dict)
    retrieved = next(r.find(foo='bar'))
    assert retrieved['uid'] == inserted
Ejemplo n.º 2
0
def test_request_find():
    r = RequestReference(host=TESTING_CONFIG['host'],
                        port=TESTING_CONFIG['port'])
    req_dict = dict(sample='hidefix', time=time.time(),
                    uid=str(uuid4()), state='active', seq_num=0, foo='bar',
                    hero='obelix', antihero='romans')
    inserted = r.create(**req_dict)
    retrieved = next(r.find(foo='bar'))
    assert retrieved['uid'] == inserted
Ejemplo n.º 3
0
def test_update_request():
    r = RequestReference(host=TESTING_CONFIG['host'],
                        port=TESTING_CONFIG['port'])
    m_uid = str(uuid4())
    req_dict = dict(sample='hidefix', time=time.time(),
                    uid=m_uid, state='active', seq_num=0, foo='bar',
                    hero='obelix', antihero='romans')
    r.create(**req_dict)
    r.update(query={'uid': m_uid},
                       update={'state': 'inactive'})
    updated_req = next(r.find(uid=m_uid))
    assert updated_req['state'] == 'inactive'
Ejemplo n.º 4
0
def test_update_request():
    r = RequestReference(host=TESTING_CONFIG['host'],
                        port=TESTING_CONFIG['port'])
    m_uid = str(uuid4())
    req_dict = dict(sample='hidefix', time=time.time(),
                    uid=m_uid, state='active', seq_num=0, foo='bar',
                    hero='obelix', antihero='romans')
    r.create(**req_dict)
    r.update(query={'uid': m_uid},
                       update={'state': 'inactive'})
    updated_req = next(r.find(uid=m_uid))
    assert updated_req['state'] == 'inactive'
Ejemplo n.º 5
0
def test_req_connection_switch():
    r = RequestReference()
    r.host = 'bogus_paigh'
    pytest.raises(ConnectionError, r.create, 'test')
    r.host = 'localhost'
    list(r.find())
Ejemplo n.º 6
0
def test_req_connection_switch():
    r = RequestReference()
    r.host = 'bogus_paigh'
    pytest.raises(ConnectionError, r.create, 'test')
    r.host = 'localhost'
    list(r.find())