def test_do_profile_delete_not_found(self): service = mock.Mock() args = {'id': ['profile1', 'profile2']} args = self._make_args(args) sh.do_profile_delete(service, args) service.delete_profile.side_effect = oexc.ResourceNotFound ex = self.assertRaises(exc.CommandError, sh.do_profile_delete, service, args) msg = _("Failed to delete some of the specified profile(s).") self.assertEqual(msg, six.text_type(ex)) service.delete_profile.assert_called_with('profile2', False)
def test_do_profile_delete_fail(self): service = mock.Mock() args = {'id': ['profile1', 'profile2']} args = self._make_args(args) sh.do_profile_delete(service, args) ex = Exception() service.delete_profile.side_effect = ex ex = self.assertRaises(exc.CommandError, sh.do_profile_delete, service, args) self.assertEqual(_('Failed to delete some of the specified ' 'profile(s).'), six.text_type(ex)) service.delete_profile.assert_called_with('profile2')
def test_do_profile_delete(self): service = mock.Mock() args = {'id': ['profile_id']} args = self._make_args(args) sh.do_profile_delete(service, args) service.delete_profile.assert_called_with('profile_id', False)