Skip to content

Commit 3c4beca

Browse files
test: Add failing settings test (#255)
Co-authored-by: Stepan Burlakov <[email protected]>
1 parent dc33320 commit 3c4beca

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/firebolt/common/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
def from_env(var_name: str, default: Any = None) -> Callable:
3535
def inner() -> Any:
36-
os.environ.get(var_name, default)
36+
return os.environ.get(var_name, default)
3737

3838
return inner
3939

tests/unit/common/test_settings.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,16 @@ def test_settings_auth_credentials(kwargs) -> None:
4848
def test_no_deprecation_warning_with_env(logger_mock: Mock):
4949
with patch.dict(
5050
os.environ,
51-
{"FIREBOLT_USER": "user", "FIREBOLT_PASSWORD": "password"},
51+
{
52+
"FIREBOLT_USER": "user",
53+
"FIREBOLT_PASSWORD": "password",
54+
"FIREBOLT_SERVER": "dummy.firebolt.io",
55+
},
5256
clear=True,
5357
):
54-
s = Settings(server="server", default_region="region")
58+
s = Settings(default_region="region")
5559
logger_mock.warning.assert_not_called()
60+
assert s.server == "dummy.firebolt.io"
5661
assert s.auth is not None, "Settings.auth wasn't populated from env variables"
5762
assert s.auth.username == "user", "Invalid username in Settings.auth"
5863
assert s.auth.password == "password", "Invalid password in Settings.auth"

0 commit comments

Comments
 (0)