'Test move a component and move it back (undo).'

def test_move_undo(self):

    parent = self.get_item_from_modulestore(self.vert_usage_key)
    original_index = _get_source_index(self.html_usage_key, parent)
    response = self._move_component(self.html_usage_key, self.vert2_usage_key)
    response = json.loads(response.content)
    self.assertEquals(original_index, response['source_index'])
    parent = self.get_item_from_modulestore(self.vert2_usage_key)
    self.assertEqual(self.html_usage_key, parent.children[(-1)])
    source_index = _get_source_index(self.html_usage_key, parent)
    self.assertNotEquals(original_index, source_index)
    response = self._move_component(self.html_usage_key, self.vert_usage_key, response['source_index'])
    response = json.loads(response.content)
    self.assertEquals(original_index, response['source_index'])
