Skip to content

Commit

Permalink
Banner: Add unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Yevhen Fastiuk <[email protected]>
  • Loading branch information
fastiuk committed May 14, 2024
1 parent 24274a0 commit 8c8143d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/hostcfgd/hostcfgd_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,3 +312,20 @@ def test_load(self):
data = {}
dns_cfg.load(data)
dns_cfg.dns_update.assert_called()


class TestBannerCfg:
def test_load(self):
banner_cfg = hostcfgd.BannerCfg()
banner_cfg.banner_message = mock.MagicMock()

data = {}
banner_cfg.load(data)
banner_cfg.banner_message.assert_called()

@mock.patch('hostcfgd.run_cmd')
def test_banner_message(self, mock_run_cmd):
banner_cfg = hostcfgd.BannerCfg()
banner_cfg.banner_message(None, {'test': 'test'})

mock_run_cmd.assert_has_calls([call(['systemctl', 'restart', 'banner-config'], True, True)])

0 comments on commit 8c8143d

Please sign in to comment.