File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1616
1717import scuba .__main__ as main
1818import scuba .dockerutil
19+ import scuba .utils
1920
2021from .const import DOCKER_IMAGE
2122from .utils import (
@@ -1186,3 +1187,26 @@ def test_volumes_named(self) -> None:
11861187 # Invoke scuba again: Verify the file is still there
11871188 out , _ = run_scuba (["/bin/sh" , "-c" , f"cat { test_path } " ])
11881189 assert_str_equalish (out , test_str )
1190+
1191+
1192+ class TestMainUmask (MainTest ):
1193+ def test_umask (self ) -> None :
1194+ """Verify umask is set properly"""
1195+ SCUBA_YML .write_text (f"image: { DOCKER_IMAGE } " )
1196+
1197+ FAKE_UMASK = 0o123 # unlikely
1198+
1199+ def mocked_get_umask () -> int :
1200+ return FAKE_UMASK
1201+
1202+ # http://alexmarandon.com/articles/python_mock_gotchas/#patching-in-the-wrong-place
1203+ # http://www.voidspace.org.uk/python/mock/patch.html#where-to-patch
1204+ with mock .patch ("scuba.scuba.get_umask" , side_effect = mocked_get_umask ) as m :
1205+ args = ["/bin/sh" , "-c" , "umask" ]
1206+ out , _ = run_scuba (args )
1207+
1208+ m .assert_called_once ()
1209+
1210+ assert out .startswith ("0" )
1211+ result_umask = int (out , 8 )
1212+ assert result_umask == FAKE_UMASK
You can’t perform that action at this time.
0 commit comments