Skip to content

Commit

Permalink
Update unit tests to account for config handling change
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Feb 6, 2025
1 parent 0d23f08 commit 8635b7c
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions tests/test_enclosure_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,29 +101,24 @@ def test_enclosure_service(self):
class TestCLI(unittest.TestCase):
runner = CliRunner()

@patch("neon_enclosure.cli.init_config_dir")
@patch("neon_enclosure.__main__.main")
def test_run(self, main, init_config):
def test_run(self, main):
from neon_enclosure.cli import run
self.runner.invoke(run)
init_config.assert_called_once()
main.assert_called_once()

@patch("os.geteuid")
@patch("neon_enclosure.cli.init_config_dir")
@patch("neon_enclosure.admin.__main__.main")
def test_run_admin(self, main, init_config, get_id):
def test_run_admin(self, main, get_id):
from neon_enclosure.cli import run_admin
# Non-root
get_id.return_value = 100
self.runner.invoke(run_admin)
init_config.assert_not_called()
main.assert_not_called()

# Root
get_id.return_value = 0
self.runner.invoke(run_admin)
init_config.assert_called_once()
main.assert_called_once()


Expand Down

0 comments on commit 8635b7c

Please sign in to comment.