This repository was archived by the owner on Feb 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_config.py
More file actions
41 lines (36 loc) · 1.36 KB
/
test_config.py
File metadata and controls
41 lines (36 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import pytest
from streamdal import StreamdalConfig
class TestStreamdalConfig:
def test_valid_config(self):
# A valid config should not raise any exception
config = StreamdalConfig(
service_name="MyService",
streamdal_url="localhost:8082",
streamdal_token="fake token",
)
assert config.validate() is None
def test_missing_config(self):
# Test when a required field (service_name) is missing
with pytest.raises(ValueError, match="service_name is required"):
cfg = StreamdalConfig(
service_name="",
streamdal_url="localhost:8082",
streamdal_token="fake token",
)
cfg.validate()
# Test when streamdal_url is missing
with pytest.raises(ValueError, match="streamdal_url is required"):
cfg = StreamdalConfig(
service_name="writer",
streamdal_url="",
streamdal_token="fake token",
)
cfg.validate()
# Test when streamdal_token is missing
with pytest.raises(ValueError, match="streamdal_token is required"):
cfg = StreamdalConfig(
service_name="writer",
streamdal_url="localhost:8082",
streamdal_token="",
)
cfg.validate()