def test_freeze_success_two_freeze(self, makedirs, status, fopen, dump): """ Test to freeze a current installation """ # Freeze the current new state status.return_value = False salt_mock = { "pkg.list_pkgs": MagicMock(return_value={}), "pkg.list_repos": MagicMock(return_value={}), } with patch.dict(freezer.__salt__, salt_mock): self.assertTrue(freezer.freeze("one")) self.assertTrue(freezer.freeze("two")) self.assertEqual(makedirs.call_count, 2) self.assertEqual(salt_mock["pkg.list_pkgs"].call_count, 2) self.assertEqual(salt_mock["pkg.list_repos"].call_count, 2) fopen.assert_called() dump.assert_called()
def test_freeze_success_two_freeze(self, makedirs, status, fopen, dump): ''' Test to freeze a current installation ''' # Freeze the current new state status.return_value = False salt_mock = { 'pkg.list_pkgs': MagicMock(return_value={}), 'pkg.list_repos': MagicMock(return_value={}), } with patch.dict(freezer.__salt__, salt_mock): self.assertTrue(freezer.freeze('one')) self.assertTrue(freezer.freeze('two')) self.assertEqual(makedirs.call_count, 2) self.assertEqual(salt_mock['pkg.list_pkgs'].call_count, 2) self.assertEqual(salt_mock['pkg.list_repos'].call_count, 2) fopen.assert_called() dump.assert_called()
def test_freeze_success_force(self, makedirs, status, fopen, dump): ''' Test to freeze a current installation ''' # Freeze the current old state status.return_value = True salt_mock = { 'pkg.list_pkgs': MagicMock(return_value={}), 'pkg.list_repos': MagicMock(return_value={}), } with patch.dict(freezer.__salt__, salt_mock): self.assertTrue(freezer.freeze(force=True)) makedirs.assert_called_once() salt_mock['pkg.list_pkgs'].assert_called_once() salt_mock['pkg.list_repos'].assert_called_once() fopen.assert_called() dump.assert_called()
def test_freeze_success_new_state(self, makedirs, status, fopen, dump): """ Test to freeze a current installation """ # Freeze the current new state status.return_value = False salt_mock = { "pkg.list_pkgs": MagicMock(return_value={}), "pkg.list_repos": MagicMock(return_value={}), } with patch.dict(freezer.__salt__, salt_mock): self.assertTrue(freezer.freeze()) makedirs.assert_called_once() salt_mock["pkg.list_pkgs"].assert_called_once() salt_mock["pkg.list_repos"].assert_called_once() fopen.assert_called() dump.assert_called()