def test_click_no_error_with_sudo_non_root_for_providers(self): for provider in ["lxd", "multipass"]: self.useFixture( fixtures.EnvironmentVariable("SNAPCRAFT_BUILD_ENVIRONMENT", provider) ) self.fake_euid.return_value = 1000 options._sanity_check_build_provider_flags(provider)
def test_click_warn_sudo(self, warning_mock): options._sanity_check_build_provider_flags("host") warning_mock.assert_called_once_with( "Running with 'sudo' may cause permission errors and is discouraged. Use 'sudo' when cleaning." )
def test_click_no_warn_sudo_non_root_with_host(self, echo_mock): self.fake_euid.return_value = 1000 options._sanity_check_build_provider_flags("host") echo_mock.assert_not_called()