コード例 #1
0
ファイル: test_request_commands.py プロジェクト: ryde/amostra
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
コード例 #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
コード例 #3
0
ファイル: test_request_commands.py プロジェクト: ryde/amostra
def test_request_create():
    req1= RequestReference(host=TESTING_CONFIG['host'],
                           port=TESTING_CONFIG['port'])

    req2 = RequestReference(host=TESTING_CONFIG['host'],
                           port=TESTING_CONFIG['port'])
    req2.create(sample='roman_sample', time=time.time(),
               uid=None, state='active', seq_num=0, foo='bar',
               hero='asterix', antihero='romans')
コード例 #4
0
def test_request_create():
    req1= RequestReference(host=TESTING_CONFIG['host'],
                           port=TESTING_CONFIG['port'])

    req2 = RequestReference(host=TESTING_CONFIG['host'],
                           port=TESTING_CONFIG['port'])
    req2.create(sample='roman_sample', time=time.time(),
               uid=None, state='active', seq_num=0, foo='bar',
               hero='asterix', antihero='romans')
    req2.host = 'hail_caesar'
    pytest.raises(ConnectionError, req2.create, sample='roman_sample')
コード例 #5
0
def test_duplicate_request():
    m_uid = str(uuid4())
    req1= RequestReference(host=TESTING_CONFIG['host'],
                           port=TESTING_CONFIG['port'])
    req1.create(sample='hidefix', time=time.time(),
               uid=m_uid, state='active', seq_num=0, foo='bar',
               hero='asterix', antihero='romans')
    req2 = RequestReference(host=TESTING_CONFIG['host'],
                           port=TESTING_CONFIG['port'])
    pytest.raises(HTTPError, req2.create, sample='hidefix', time=time.time(),
               uid=m_uid, state='active', seq_num=0, foo='bar',
               hero='asterix', antihero='romans')
コード例 #6
0
ファイル: test_request_commands.py プロジェクト: ryde/amostra
def test_duplicate_request():
    m_uid = str(uuid4())
    req1= RequestReference(host=TESTING_CONFIG['host'],
                           port=TESTING_CONFIG['port'])
    req1.create(sample='hidefix', time=time.time(),
               uid=m_uid, state='active', seq_num=0, foo='bar',
               hero='asterix', antihero='romans')
    req2 = RequestReference(host=TESTING_CONFIG['host'],
                           port=TESTING_CONFIG['port'])
    pytest.raises(HTTPError, req2.create, sample='hidefix', time=time.time(),
               uid=m_uid, state='active', seq_num=0, foo='bar',
               hero='asterix', antihero='romans')
コード例 #7
0
ファイル: test_request_commands.py プロジェクト: ryde/amostra
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'
コード例 #8
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'
コード例 #9
0
def test_request_create():
    req1 = RequestReference(host=TESTING_CONFIG['host'],
                            port=TESTING_CONFIG['port'])

    req2 = RequestReference(host=TESTING_CONFIG['host'],
                            port=TESTING_CONFIG['port'])
    req2.create(sample='roman_sample',
                time=time.time(),
                uid=None,
                state='active',
                seq_num=0,
                foo='bar',
                hero='asterix',
                antihero='romans')
    req2.host = 'hail_caesar'
    pytest.raises(ConnectionError, req2.create, sample='roman_sample')
コード例 #10
0
def test_req_connection_switch():
    r = RequestReference()
    r.host = 'bogus_paigh'
    pytest.raises(ConnectionError, r.create, 'test')
    r.host = 'localhost'
    list(r.find())
コード例 #11
0
ファイル: test_request_commands.py プロジェクト: ryde/amostra
def test_request_constructor_config():
    r1 = RequestReference(host=TESTING_CONFIG['host'],
                          port=TESTING_CONFIG['port'])
    assert r1.host == TESTING_CONFIG['host']
    assert r1.port == TESTING_CONFIG['port']
コード例 #12
0
def test_req_connection_switch():
    r = RequestReference()
    r.host = 'bogus_paigh'
    pytest.raises(ConnectionError, r.create, 'test')
    r.host = 'localhost'
    list(r.find())