geeViz.eeAuth.tests.test_eeCreds¶
Tests for the eeCreds high-level API.
Functions
|
|
|
|
|
Bytes input is decoded as UTF-8 or base64. |
|
addCreds returns self for fluent style. |
|
|
|
Even without type=authorized_user, presence of refresh_token → OAuth. |
|
|
|
|
|
|
|
|
|
|
|
Without explicit .use(), .current() returns the first registered name. |
|
The default tenant_header should be geeViz-branded so it's obviously library-owned in browser DevTools / packet captures. |
|
Polymorphism: build_proxy_router should accept an EECreds the same way it accepts an SARegistry. |
|
The old |
|
If every port in the explicit walk range is taken, the OS picks any free port (port 0 in bind() means ephemeral). |
|
When the preferred port is bindable, return it as-is. |
|
When the preferred port is busy, walk up until a free one is found. |
|
If no upstream is registered, /ee-api requests must 503 cleanly rather than hanging or crashing the server. |
|
|
|
End-to-end: stand up a stub upstream + the geeViz handler, hit /ee-api/* on the handler, and verify the request lands at the upstream with the tenant header stamped and the response streamed back. |
|
First get_token mints; second returns the cache; force_refresh re-mints. |
|
Forgiving lookup — unknown name → first registered. |
|
|
|
End-to-end: when proxy_port is busy, start() should still succeed on an alternate port, and proxy_url reflects the actual port. |
|
|
|
The tenant must be baked into the per-session run_js (NOT the page URL). |
|
When eeCreds isn't started (proxy_url is None), Map.view() must fall back to the legacy direct-token mint path. |
|
When eeCreds.proxy_url is set, Map.view() must register that upstream with the local HTTP server so /ee-api/* gets reverse-proxied — and keep the viewer URL empty (no proxy address baked in). |
|
|
|
If the JSON has its own client_id/client_secret (e.g. a custom OAuth app), those win over EE's well-known fallback. |
|
Tenant resolution order: explicit ?tenant on the request → ?tenant on the Referer URL → |
|
|
|
|
|
If only one credential is registered, get_token returns it without any .use() call needed — the simplest possible path 'works automatically'. |
|
|
|
start(launch_proxy=False, ee_init=False) is idempotent + reports state. |
|
eeCreds.stop() must clear the proxy thread + URL so the registry can be restarted cleanly. |
|
Calling stop() on a never-started registry should be a no-op rather than crashing. |
|
A stopped registry can be started again. |
|
sync_oauth_project with the same project that's already set should be a no-op (no log noise, no token invalidation). |
|
The SDK placeholder |
|
sync_oauth_project should update every OAuth entry's project_id and invalidate cached tokens, so the next mint includes the new project. |
|
build_proxy_router must accept tenant_header= so deployments can use whatever name they want (e.g. AskTerra agent uses X-AskTerra-Tenant for back-compat). |
|
|
|
Plain .use() (no with) takes effect right away. |
|