Fetch trino credentials and test

This commit is contained in:
Pablo Martin 2023-01-13 14:56:36 +01:00
parent 707ac6ad7c
commit 503c70fa02
2 changed files with 45 additions and 4 deletions

View file

@ -4,12 +4,10 @@ from lolafect.lolaconfig import LolaConfig
def test_lolaconfig_instantiates_with_defaults_properly():
lolaconfig = LolaConfig(flow_name="some-flow")
def test_lolaconfig_instantiates_without_defaults_proplery():
lolaconfig = LolaConfig(
flow_name="some-flow",
env_s3_bucket="bucket",
@ -20,7 +18,6 @@ def test_lolaconfig_instantiates_without_defaults_proplery():
def test_lolaconfig_fetches_webhooks_properly():
lolaconfig = LolaConfig(flow_name="some-flow")
fake_s3_reader = SimpleNamespace()
@ -33,3 +30,23 @@ def test_lolaconfig_fetches_webhooks_properly():
lolaconfig.fetch_slack_webhooks(s3_reader=fake_s3_reader)
assert type(lolaconfig.SLACK_WEBHOOKS) is dict
def test_lolaconfig_fetches_trino_creds_properly():
lolaconfig = LolaConfig(flow_name="some-flow")
fake_s3_reader = SimpleNamespace()
def mock_read_json_from_s3_file(bucket, key):
return {
"trino_host": "some_host",
"trino_user": "some_user",
"trino_pass": "some_password",
"trino_port": "some_port",
}
fake_s3_reader.read_json_from_s3_file = mock_read_json_from_s3_file
lolaconfig.fetch_trino_credentials(s3_reader=fake_s3_reader)
assert type(lolaconfig.TRINO_CREDENTIALS) is dict