예제 #1
0
def test_upstream_url(urn_test_request_dict):
    os.environ['JUSSI_ACCOUNT_TRANSFER_STEEMD_URL'] = 'account_transfer_url'
    upstreams = _Upstreams(TEST_UPSTREAM_CONFIG, validate=False)
    jsonrpc_request, urn, url, ttl, timeout = urn_test_request_dict
    test_urn = from_request(jsonrpc_request)
    upstream = Upstream.from_urn(test_urn, upstreams=upstreams)
    del os.environ['JUSSI_ACCOUNT_TRANSFER_STEEMD_URL']
    assert upstream.url == url
예제 #2
0
def test_invalid_numeric_steemd_api():
    jsonrpc_request = {
        'id': 11,
        'jsonrpc': '2.0',
        'method': 'call',
        'params': [2, "login", ["", ""]]
    }
    with pytest.raises(InvalidNamespaceAPIError):
        result = str(from_request(jsonrpc_request))
예제 #3
0
def test_urn_params_serialization(jsonrpc_request, expected):
    result_urn = from_request(jsonrpc_request)
    assert str(result_urn) == expected
예제 #4
0
def test_urn_not_eq(full_urn_test_request_dict):
    jsonrpc_request, urn_parsed, urn, url, ttl, timeout = full_urn_test_request_dict
    result_urn = from_request(jsonrpc_request)
    assert result_urn != 'nope'
예제 #5
0
def test_urn_hash(full_urn_test_request_dict):
    jsonrpc_request, urn_parsed, urn, url, ttl, timeout = full_urn_test_request_dict
    result_urn = from_request(jsonrpc_request)
    assert hash(result_urn) == hash(urn)
예제 #6
0
def test_urn_params_empty_list(jsonrpc_request, expected):
    result = str(from_request(jsonrpc_request))
    assert result == expected
예제 #7
0
def test_urn_pairs(steemd_method_pairs):
    old, new = steemd_method_pairs
    old_urn = str(from_request(old))
    new_urn = str(from_request(new))
    assert old_urn == new_urn
    assert old_urn.startswith('steemd.database_api')
예제 #8
0
def test_urn_params_no_params(jsonrpc_request, expected):
    _parse_jrpc_method.cache_clear()
    result = str(from_request(jsonrpc_request))
    assert result == expected
예제 #9
0
def test_urns(urn_test_request_dict):
    jsonrpc_request, urn, url, ttl, timeout = urn_test_request_dict
    result = str(from_request(jsonrpc_request))
    assert result == urn
예제 #10
0
def test_upstream_timeout(urn_test_request_dict):
    upstreams = _Upstreams(TEST_UPSTREAM_CONFIG, validate=False)
    jsonrpc_request, urn, url, ttl, timeout = urn_test_request_dict
    test_urn = from_request(jsonrpc_request)
    upstream = Upstream.from_urn(test_urn, upstreams=upstreams)
    assert upstream.timeout == timeout