'Test what happens when the user_partition_id is changed to a different groups
group configuration.'

def test_change_user_partition_id(self):

    split_test = self._update_partition_id(self.first_user_partition.id)
    self.assertEqual(2, len(split_test.children))
    initial_vertical_0_location = split_test.children[0]
    initial_vertical_1_location = split_test.children[1]
    split_test = self._update_partition_id(self.second_user_partition.id)
    self.assertEqual(5, len(split_test.children))
    self.assertEqual(initial_vertical_0_location, split_test.children[0])
    self.assertEqual(initial_vertical_1_location, split_test.children[1])
    vertical_0 = self.get_item_from_modulestore(split_test.children[2], verify_is_draft=True)
    vertical_1 = self.get_item_from_modulestore(split_test.children[3], verify_is_draft=True)
    vertical_2 = self.get_item_from_modulestore(split_test.children[4], verify_is_draft=True)
    self.assertEqual(3, len(split_test.group_id_to_child))
    self.assertEqual(vertical_0.location, split_test.group_id_to_child[str(self.second_user_partition_group_1.id)])
    self.assertEqual(vertical_1.location, split_test.group_id_to_child[str(self.second_user_partition_group_2.id)])
    self.assertEqual(vertical_2.location, split_test.group_id_to_child[str(self.second_user_partition_group_3.id)])
    self.assertNotEqual(initial_vertical_0_location, vertical_0.location)
    self.assertNotEqual(initial_vertical_1_location, vertical_1.location)
