Exemple #1
0
 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)
Exemple #2
0
 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)
Exemple #3
0
 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)
Exemple #4
0
 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)