def test_delete(self):
    'Test `verdi group delete` command.'
    orm.Group(label='group_test_delete_01').store()
    orm.Group(label='group_test_delete_02').store()
    result = self.cli_runner.invoke(group_delete, ['--force', 'group_test_delete_01'])
    self.assertClickResultNoException(result)
    result = self.cli_runner.invoke(group_list)
    self.assertClickResultNoException(result)
    self.assertNotIn('group_test_delete_01', result.output)
    node_01 = orm.CalculationNode().store()
    node_02 = orm.CalculationNode().store()
    group = orm.load_group(label='group_test_delete_02')
    group.add_nodes([node_01, node_02])
    self.assertEqual(group.count(), 2)
    result = self.cli_runner.invoke(group_delete, ['--force', 'group_test_delete_02'])
    self.assertIsNotNone(result.exception, result.output)
    result = self.cli_runner.invoke(group_delete, ['--force', '--clear', 'group_test_delete_02'])
    self.assertClickResultNoException(result)
    with self.assertRaises(exceptions.NotExistent):
        group = orm.load_group(label='group_test_delete_02')
Test `verdi group delete` command.
def test_delete(self):
    
    orm.Group(label='group_test_delete_01').store()
    orm.Group(label='group_test_delete_02').store()
    result = self.cli_runner.invoke(group_delete, ['--force', 'group_test_delete_01'])
    self.assertClickResultNoException(result)
    result = self.cli_runner.invoke(group_list)
    self.assertClickResultNoException(result)
    self.assertNotIn('group_test_delete_01', result.output)
    node_01 = orm.CalculationNode().store()
    node_02 = orm.CalculationNode().store()
    group = orm.load_group(label='group_test_delete_02')
    group.add_nodes([node_01, node_02])
    self.assertEqual(group.count(), 2)
    result = self.cli_runner.invoke(group_delete, ['--force', 'group_test_delete_02'])
    self.assertIsNotNone(result.exception, result.output)
    result = self.cli_runner.invoke(group_delete, ['--force', '--clear', 'group_test_delete_02'])
    self.assertClickResultNoException(result)
    with self.assertRaises(exceptions.NotExistent):
        group = orm.load_group(label='group_test_delete_02')