File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ """Tests for Jinja2 CQL2 filter."""
2+
3+ import pytest
4+ from fastapi .testclient import TestClient
5+ from utils import AppFactory
6+
7+ app_factory = AppFactory (
8+ oidc_discovery_url = "https://example-stac-api.com/.well-known/openid-configuration" ,
9+ default_public = False ,
10+ )
11+
12+
13+ def test_collections_filter_contained_by_token (source_api_server , token_builder ):
14+ """"""
15+ app = app_factory (
16+ upstream_url = source_api_server ,
17+ collections_filter = {
18+ "cls" : "stac_auth_proxy.filters.Template" ,
19+ "args" : [
20+ "A_CONTAINEDBY(id, ( '{{ token.collections | join(\" ', '\" ) }}' ))"
21+ ],
22+ },
23+ )
24+ client = TestClient (
25+ app ,
26+ headers = {
27+ "Authorization" : f"Bearer { token_builder ({"collections" : ["foo" , "bar" ]})} "
28+ },
29+ )
30+ response = client .get ("/collections" )
31+ assert response .status_code == 200
32+
33+ # TODO: We need to verify that the upstream API was called with an applied filter
You can’t perform that action at this time.
0 commit comments