File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ def save_configuration_file(
43
43
rc_file .writelines (lines )
44
44
rc_file .close ()
45
45
46
+ settings ._initialize ()
47
+
46
48
47
49
def _get_default_token () -> str :
48
50
"""Get the default token from the configuration file."""
@@ -106,6 +108,7 @@ def configure(
106
108
107
109
try :
108
110
save_configuration_file (token , enable_metrics , remote_inferencing )
111
+ # update setting singleton
109
112
logger .info ("Configuration saved." )
110
113
except Exception as e :
111
114
logger .error ("An unexpected error occured saving configuration!" )
Original file line number Diff line number Diff line change @@ -69,6 +69,9 @@ def test_save_configuration_file(mocker):
69
69
expanduser_mock = mocker .patch ("guardrails.cli.configure.expanduser" )
70
70
expanduser_mock .return_value = "/Home"
71
71
72
+ rcexpanduser_mock = mocker .patch ("guardrails.classes.rc.expanduser" )
73
+ rcexpanduser_mock .return_value = "/Home"
74
+
72
75
import os
73
76
74
77
join_spy = mocker .spy (os .path , "join" )
@@ -88,7 +91,9 @@ def test_save_configuration_file(mocker):
88
91
save_configuration_file ("token" , True )
89
92
90
93
assert expanduser_mock .called is True
91
- join_spy .assert_called_once_with ("/Home" , ".guardrailsrc" )
94
+ assert rcexpanduser_mock .called is True
95
+ join_spy .assert_called_with ("/Home" , ".guardrailsrc" )
96
+ assert join_spy .call_count == 2
92
97
93
98
assert mock_open .call_count == 1
94
99
writelines_spy .assert_called_once_with (
You can’t perform that action at this time.
0 commit comments