lolafect/tests/test_lolaconfig.py
2023-01-09 13:38:49 +01:00

35 lines
930 B
Python

from types import SimpleNamespace
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",
kubernetes_labels=["some_label"],
kubernetes_image="loliloli:latest",
slack_webhooks_file="the_file/is/here.json",
)
def test_lolaconfig_fetches_webhooks_properly():
lolaconfig = LolaConfig(flow_name="some-flow")
fake_s3_reader = SimpleNamespace()
def mock_read_json_from_s3_file(bucket, key):
return {"a-channel-name": "a-channel-url.com"}
fake_s3_reader.read_json_from_s3_file = mock_read_json_from_s3_file
lolaconfig.fetch_slack_webhooks(s3_reader=fake_s3_reader)
assert type(lolaconfig.SLACK_WEBHOOKS) is dict