Beispiel #1
0
 def test_invalid_client(self):
     client = "BAD TYPE"
     with pytest.raises(
             TypeError,
             match="This `client` class should be an instance "
             "of `stellar_sdk.client.base_async_client.BaseAsyncClient` "
             "or `stellar_sdk.client.base_sync_client.BaseSyncClient`.",
     ):
         fetch_stellar_toml("httpbin.org", client)
Beispiel #2
0
 def _get_client_signing_key(client_domain):
     client_toml_contents = fetch_stellar_toml(
         client_domain,
         client=RequestsClient(request_timeout=settings.
                               SEP10_CLIENT_ATTRIBUTION_REQUEST_TIMEOUT),
     )
     client_signing_key = client_toml_contents.get("SIGNING_KEY")
     if not client_signing_key:
         raise ValueError(
             gettext("SIGNING_KEY not present on 'client_domain' TOML"))
     try:
         Keypair.from_public_key(client_signing_key)
     except Ed25519PublicKeyInvalidError:
         raise ValueError(
             gettext("invalid SIGNING_KEY value on 'client_domain' TOML"))
     return client_signing_key
Beispiel #3
0
 def test_get_success_sync(self):
     toml = fetch_stellar_toml("overcat.me", None)
     assert toml.get(
         "FEDERATION_SERVER") == "https://federation.overcat.workers.dev"
Beispiel #4
0
 def test_get_not_found(self):
     with pytest.raises(StellarTomlNotFoundError):
         fetch_stellar_toml("httpbin.org")