def test_reinstall_paste_ini_idempotent(self, kv): """Ensure that re-running does not re-install files""" test_kv = SimpleKV() test_kv.set(utils.PASTE_INI_MARKER, True) kv.return_value = test_kv utils.reinstall_paste_ini() self.assertFalse(self.apt_install.called)
def test_reinstall_paste_ini_fix_upgrade(self, kv, mock_os_release, mock_exists): mock_exists.return_value = False mock_os_release.return_value = "queens" test_kv = SimpleKV() test_kv.set(utils.PASTE_INI_MARKER, True) kv.return_value = test_kv utils.reinstall_paste_ini() self.assertTrue(self.apt_install.called)
def test_reinstall_paste_ini_idempotent(self, kv, mock_os_release, mock_exists): """Ensure that re-running does not re-install files""" mock_exists.return_value = True mock_os_release.return_value = "queens" test_kv = SimpleKV() test_kv.set(utils.PASTE_INI_MARKER, True) kv.return_value = test_kv utils.reinstall_paste_ini() self.assertFalse(self.apt_install.called)
def test_reinstall_paste_ini(self, kv, _os): """Ensure that paste.ini files are re-installed""" _os.path.exists.return_value = True test_kv = SimpleKV() kv.return_value = test_kv utils.reinstall_paste_ini() self.apt_install.assert_called_with( packages=['glance-api', 'glance-registry'], options=utils.REINSTALL_OPTIONS, fatal=True) _os.path.exists.assert_has_calls([ call(utils.GLANCE_REGISTRY_PASTE), call(utils.GLANCE_API_PASTE), ]) _os.remove.assert_has_calls([ call(utils.GLANCE_REGISTRY_PASTE), call(utils.GLANCE_API_PASTE), ]) self.assertTrue(test_kv.get(utils.PASTE_INI_MARKER)) self.assertTrue(test_kv.flushed)
def test_reinstall_paste_ini_queens(self, kv, _os, mock_os_release): """Ensure that paste.ini files are re-installed""" mock_os_release.return_value = 'queens' _os.path.exists.return_value = True test_kv = SimpleKV() kv.return_value = test_kv utils.reinstall_paste_ini() self.apt_install.assert_called_with(packages=['glance-api'], options=utils.REINSTALL_OPTIONS, fatal=True)
def test_reinstall_paste_ini(self, kv, _os): """Ensure that paste.ini files are re-installed""" _os.path.exists.return_value = True test_kv = SimpleKV() kv.return_value = test_kv utils.reinstall_paste_ini() self.apt_install.assert_called_with( packages=['glance-api', 'glance-registry'], options=utils.REINSTALL_OPTIONS, fatal=True ) _os.path.exists.assert_has_calls([ call(utils.GLANCE_REGISTRY_PASTE), call(utils.GLANCE_API_PASTE), ]) _os.remove.assert_has_calls([ call(utils.GLANCE_REGISTRY_PASTE), call(utils.GLANCE_API_PASTE), ]) self.assertTrue(test_kv.get(utils.PASTE_INI_MARKER)) self.assertTrue(test_kv.flushed)