@@ -131,8 +131,20 @@ def test_command_exists_su_config_only(self):
131131
132132
133133class TestMakeUnixCommandConnectorUtilWarnings (TestCase ):
134+ def test_doas_warnings (self ):
135+ state = State (make_inventory (), Config (SU_USER = True , SUDO = True ))
136+
137+ with patch ('pyinfra.api.connectors.util._warn_invalid_auth_args' ) as fake_auth_args :
138+ command = make_unix_command ('echo Šablony' , state = state )
139+
140+ assert command .get_raw_value () == "sh -c 'echo Šablony'"
141+ fake_auth_args .assert_called_once ()
142+ _ , args , kwargs = fake_auth_args .mock_calls [0 ]
143+ assert args [1 ] == 'doas'
144+ assert args [2 ] == ('doas_user' ,)
145+
134146 def test_sudo_warnings (self ):
135- state = State (make_inventory (), Config (SU_USER = True ))
147+ state = State (make_inventory (), Config (SU_USER = True , DOAS = True ))
136148
137149 with patch ('pyinfra.api.connectors.util._warn_invalid_auth_args' ) as fake_auth_args :
138150 command = make_unix_command ('echo Šablony' , state = state )
@@ -144,7 +156,7 @@ def test_sudo_warnings(self):
144156 assert args [2 ] == ('use_sudo_password' , 'use_sudo_login' , 'preserve_sudo_env' , 'sudo_user' )
145157
146158 def test_su_warnings (self ):
147- state = State (make_inventory (), Config (SUDO = True ))
159+ state = State (make_inventory (), Config (DOAS = True , SUDO = True ))
148160
149161 with patch ('pyinfra.api.connectors.util._warn_invalid_auth_args' ) as fake_auth_args :
150162 command = make_unix_command ('echo Šablony' , state = state )
0 commit comments