'If the group is deleted (or its id is changed), there\'s no referential
integrity enforced, so any references from cohorts to that group will be
lost.  A warning should be logged when links are found from cohorts to
groups that no longer exist.'

def test_missing_group(self):

    self.setup_student_in_group_0()
    new_user_partition = UserPartition(0, 'Another    Partition', 'dummy', [Group(11, 'Not    Group    10'), Group(21, 'Not    Group    20')], scheme=CohortPartitionScheme)
    with patch('openedx.core.djangoapps.course_groups.partition_scheme.log') as mock_log:
        self.assert_student_in_group(None, new_user_partition)
        self.assertTrue(mock_log.warn.called)
        self.assertRegexpMatches(mock_log.warn.call_args[0][0], 'group    not    found')
