| 1 |
from unittest.mock import patch |
| 2 |
from pytest import raises |
| 3 |
|
| 4 |
from kiwi.privileges import Privileges |
| 5 |
|
| 6 |
from kiwi.exceptions import KiwiPrivilegesError |
| 7 |
|
| 8 |
|
| 9 |
class TestPrivileges: |
| 10 |
@patch('os.geteuid') |
| 11 |
def test_check_for_root_permiossion_false(self, mock_euid): |
| 12 |
mock_euid.return_value = 1 |
| 13 |
with raises(KiwiPrivilegesError): |
| 14 |
Privileges.check_for_root_permissions() |
| 15 |
|
| 16 |
@patch('os.geteuid') |
| 17 |
def test_check_for_root_permiossion_true(self, mock_euid): |
| 18 |
mock_euid.return_value = 0 |
| 19 |
assert Privileges.check_for_root_permissions() is True |