def test_deploy(self, sudo_mock): files = {"jvm.config": "a=b"} deploy.deploy(files, "/my/remote/dir") sudo_mock.assert_any_call("mkdir -p /my/remote/dir") sudo_mock.assert_any_call("echo 'a=b' > /my/remote/dir/jvm.config")
def test_deploy(self, sudo_mock): sudo_mock.return_value = SudoResult() files = {"jvm.config": "a=b"} deploy.deploy(files, "/my/remote/dir") sudo_mock.assert_any_call("mkdir -p /my/remote/dir") sudo_mock.assert_any_call("echo 'a=b' > /my/remote/dir/jvm.config")
def test_deploys_as_presto_user(self, secure_create_file_mock, sudo_mock): deploy.deploy({'my_file': 'hello!'}, '/remote/path') secure_create_file_mock.assert_called_with('/remote/path/my_file', 'presto:presto', 600) sudo_mock.assert_called_with("echo 'hello!' > /remote/path/my_file")