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
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))
def test_urn_params_serialization(jsonrpc_request, expected): result_urn = from_request(jsonrpc_request) assert str(result_urn) == expected
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'
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)
def test_urn_params_empty_list(jsonrpc_request, expected): result = str(from_request(jsonrpc_request)) assert result == expected
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')
def test_urn_params_no_params(jsonrpc_request, expected): _parse_jrpc_method.cache_clear() result = str(from_request(jsonrpc_request)) assert result == expected
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
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