def test_prepare_msg(self): emitter = dnf.automatic.emitter.Emitter('myhost') emitter.notify_available('packages...') emitter.notify_downloaded() with mock.patch('dnf.automatic.emitter.DOWNLOADED', 'downloaded on %s:'): self.assertEqual(emitter._prepare_msg(), MSG)
def test_motd(self): m = mock_open() with mock.patch('dnf.automatic.emitter.open', m, create=True): emitter = dnf.automatic.emitter.MotdEmitter('myhost') emitter.notify_available('packages...') emitter.notify_downloaded() with mock.patch('dnf.automatic.emitter.DOWNLOADED', 'downloaded on %s:'): emitter.commit() handle = m() handle.write.assert_called_once_with(MSG)