def test_dry_run_print_only_with_failures(self): """This is what we do during PR checks and new clusters!""" self.initialize_desired_states(True) self.mock_callable(self.terraform, 'plan').to_return_value( (False, False)).and_assert_not_called() self.mock_callable( self.terraform, 'apply').to_return_value(None).and_assert_not_called() self.exit.for_call(0).and_assert_called_once() with self.assertRaises(OSError): integ.run(True, True, False)
def test_all_fine(self): self.initialize_desired_states(False) self.mock_callable(self.terraform, 'plan').to_return_value( (False, False)).and_assert_called_once() self.mock_callable( self.terraform, 'cleanup').to_return_value(None).and_assert_called_once() self.mock_callable( self.terraform, 'apply').to_return_value(None).and_assert_called_once() self.exit.for_call(0).and_assert_called_once() with self.assertRaises(OSError): integ.run(False, False, False, None)
def test_fail_state(self): """Ensure we don't change the world if there are failures""" self.initialize_desired_states(True) self.mock_callable(self.terraform, 'plan').to_return_value( (False, False)).and_assert_not_called() self.mock_callable( self.terraform, 'cleanup').to_return_value(None).and_assert_not_called() self.mock_callable( self.terraform, 'apply').to_return_value(None).and_assert_not_called() self.exit.for_call(1).and_assert_called_once() with self.assertRaises(OSError): integ.run(False, False, True)
def test_all_fine(self): self.initialize_desired_states(False) self.mock_callable(self.terraform, "plan").to_return_value( (False, False) ).and_assert_called_once() self.mock_callable(self.terraform, "cleanup").to_return_value( None ).and_assert_called_once() self.mock_callable(self.terraform, "apply").to_return_value( None ).and_assert_called_once() self.exit.for_call(0).and_assert_called_once() with self.assertRaises(OSError): integ.run(False, print_to_file=None, enable_deletion=False)