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(
4343 rc_file .writelines (lines )
4444 rc_file .close ()
4545
46+ settings ._initialize ()
47+
4648
4749def _get_default_token () -> str :
4850 """Get the default token from the configuration file."""
@@ -106,6 +108,7 @@ def configure(
106108
107109 try :
108110 save_configuration_file (token , enable_metrics , remote_inferencing )
111+ # update setting singleton
109112 logger .info ("Configuration saved." )
110113 except Exception as e :
111114 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):
6969 expanduser_mock = mocker .patch ("guardrails.cli.configure.expanduser" )
7070 expanduser_mock .return_value = "/Home"
7171
72+ rcexpanduser_mock = mocker .patch ("guardrails.classes.rc.expanduser" )
73+ rcexpanduser_mock .return_value = "/Home"
74+
7275 import os
7376
7477 join_spy = mocker .spy (os .path , "join" )
@@ -88,7 +91,9 @@ def test_save_configuration_file(mocker):
8891 save_configuration_file ("token" , True )
8992
9093 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
9297
9398 assert mock_open .call_count == 1
9499 writelines_spy .assert_called_once_with (
You can’t perform that action at this time.
0 commit comments