示例#1
0
 def test_enhancements(self, mock_extract, mock_append, mock_save, *args):
     """extract_drivers: extract selected drivers, don't save enhancements"""
     extract_drivers(drivers=[fake_enhancement])
     mock_extract.assert_called_once_with(fake_enhancement.source,
                                          "/updates")
     self.assertFalse(mock_append.called)
     self.assertFalse(mock_save.called)
示例#2
0
 def test_enhancements(self, mock_extract, mock_append, mock_save, *args):
     """extract_drivers: extract selected drivers, don't save enhancements"""
     extract_drivers(drivers=[fake_enhancement])
     mock_extract.assert_called_once_with(
         fake_enhancement.source, "/updates"
     )
     self.assertFalse(mock_append.called)
     self.assertFalse(mock_save.called)
示例#3
0
 def test_drivers(self, mock_extract, mock_append, mock_save, *args):
     """extract_drivers: save repo, write pkglist"""
     extract_drivers(drivers=[fake_enhancement, fake_module])
     # extracts all listed modules
     mock_extract.assert_has_calls([
         mock.call(fake_enhancement.source, "/updates"),
         mock.call(fake_module.source, "/updates")
     ], any_order=True)
     pkglist = "/run/install/dd_packages"
     mock_append.assert_called_once_with(pkglist, fake_module.name)
     mock_save.assert_called_once_with(fake_module.repo)
示例#4
0
 def test_drivers(self, mock_extract, mock_append, mock_save, *args):
     """extract_drivers: save repo, write pkglist"""
     extract_drivers(drivers=[fake_enhancement, fake_module])
     # extracts all listed modules
     mock_extract.assert_has_calls([
         mock.call(fake_enhancement.source, "/updates"),
         mock.call(fake_module.source, "/updates")
     ], any_order=True)
     pkglist = "/run/install/dd_packages"
     mock_append.assert_called_once_with(pkglist, fake_module.name)
     mock_save.assert_called_once_with(fake_module.repo)
示例#5
0
 def test_repo(self, mock_extract, mock_append, mock_save, *args):
     """extract_drivers(repos=[...]) extracts all drivers from named repos"""
     with mock.patch("driver_updates.dd_list", side_effect=[
         [fake_enhancement],
         [fake_enhancement, fake_module]]):
         extract_drivers(repos=['enh_repo', 'mod_repo'])
     mock_extract.assert_has_calls([
         mock.call(fake_enhancement.source, "/updates"),
         mock.call(fake_enhancement.source, "/updates"),
         mock.call(fake_module.source, "/updates")
     ])
     pkglist = "/run/install/dd_packages"
     mock_append.assert_called_once_with(pkglist, fake_module.name)
     mock_save.assert_called_once_with(fake_module.repo)
示例#6
0
 def test_repo(self, mock_extract, mock_append, mock_save, *args):
     """extract_drivers(repos=[...]) extracts all drivers from named repos"""
     with mock.patch("driver_updates.dd_list",
                     side_effect=[[fake_enhancement],
                                  [fake_enhancement, fake_module]]):
         extract_drivers(repos=['enh_repo', 'mod_repo'])
     mock_extract.assert_has_calls([
         mock.call(fake_enhancement.source, "/updates"),
         mock.call(fake_enhancement.source, "/updates"),
         mock.call(fake_module.source, "/updates")
     ])
     pkglist = "/run/install/dd_packages"
     mock_append.assert_called_once_with(pkglist, fake_module.name)
     mock_save.assert_called_once_with(fake_module.repo)