示例#1
0
def test_stream_delete_from_id():
    s = Stream(query=VALID_WHERE_STATEMENT)
    s.create()
    time.sleep(60)
    response = s.delete()
    assert isinstance(response, StreamResponse)
    assert len(response.id) > 0
示例#2
0
def test_create_stream_with_query():
    s = Stream(query=VALID_WHERE_STATEMENT)
    assert s.query.get_base_query() == {
        'query': {
            'where': VALID_WHERE_STATEMENT
        }
    }
示例#3
0
def test_stream_get_info_from_id():
    s = Stream(stream_id=VALID_STREAM_ID)
    response = s.get_info()
    assert isinstance(response, StreamResponse)
    assert len(response.id) > 0
示例#4
0
def test_stream_create_from_query():
    s = Stream(query=VALID_WHERE_STATEMENT)
    response = s.create()
    assert isinstance(response, StreamResponse)
    assert len(response.id) > 0
示例#5
0
def test_create_stream_invalid_stream():
    with pytest.raises(ValueError,
                       match=r'Not allowed stream id with query or snapshot'):
        Stream(api_key_user=VALID_USER_KEY,
               query=VALID_WHERE_STATEMENT,
               stream_id=VALID_STREAM_ID)
示例#6
0
def test_create_stream_existing_user():
    stream = Stream(stream_user=stream_user)
    assert stream.stream_user.api_key == VALID_USER_KEY
示例#7
0
def test_create_stream_request_info():
    stream = Stream(api_key_user=VALID_USER_KEY, request_userinfo=True)
    assert len(stream.stream_user.account_name) > 0
    assert stream.stream_user.max_allowed_extracted_documents != 0
示例#8
0
def test_create_stream_str_key():
    stream = Stream(api_key_user=VALID_USER_KEY)
    assert stream.stream_user.api_key == VALID_USER_KEY
示例#9
0
def test_create_stream_evironment_variable():
    stream = Stream()
    assert stream.stream_user.api_key == ENVIRONMENT_USER_KEY