Skip to content

Commit ba2569e

Browse files
committed
Add test for in-memory authn
1 parent 2baf8a7 commit ba2569e

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# config.yml
2+
trees:
3+
- path: /
4+
tree: tiled.examples.generated_minimal:tree
5+
uvicorn:
6+
host: 0.0.0.0
7+
port: 8000
8+
authentication:
9+
providers:
10+
- provider: test
11+
authenticator: tiled.authenticators:DictionaryAuthenticator
12+
args:
13+
users_to_passwords:
14+
alice: PASSWORD
15+
secret_keys:
16+
- SECRET
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from pathlib import Path
2+
3+
import numpy
4+
import yaml
5+
6+
from tiled._tests.utils import enter_username_password
7+
from tiled.client import Context, from_context
8+
from tiled.server.app import build_app_from_config
9+
10+
CONFIG_NAME = "in_memory_db.yml"
11+
CATALOG_STORAGE = "data/"
12+
13+
here = Path(__file__).parent.absolute()
14+
15+
def test_good_path():
16+
"""Test authn database defaults to in-memory catalog"""
17+
with open(here / "test_configs" / "config_in_memory_authn.yml") as config_file:
18+
config = yaml.load(config_file, Loader=yaml.BaseLoader)
19+
20+
app = build_app_from_config(config)
21+
context = Context.from_app(app)
22+
23+
with enter_username_password("alice", "PASSWORD"):
24+
client = from_context(context, remember_me=False)
25+
26+
client.logout()
27+
context.close()
28+
29+
assert True

0 commit comments

Comments
 (0)