Пример #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)
Пример #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)
Пример #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)
Пример #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)