'Test the validation messages produced for an xblock referring to non-existent groups.'

def test_validate_invalid_groups(self):

    self.set_group_access(self.video_location, {self.user_partition.id: [self.group1.id, 999]})
    validation = self.store.get_item(self.video_location).validate()
    self.assertEqual(len(validation.messages), 1)
    self.verify_validation_message(validation.messages[0], INVALID_USER_PARTITION_GROUP_VALIDATION_COMPONENT, ValidationMessage.ERROR)
    self.set_group_access(self.video_location, {self.user_partition.id: [self.group1.id, 998, 999]})
    validation = self.store.get_item(self.video_location).validate()
    self.assertEqual(len(validation.messages), 1)
    self.verify_validation_message(validation.messages[0], INVALID_USER_PARTITION_GROUP_VALIDATION_COMPONENT, ValidationMessage.ERROR)
