'Test the actual task that orchestrates data generation and updating the database.'

def test_update_course_structure(self):

    course_id = self.course.id
    self.assertRaises(ValueError, update_course_structure, course_id)
    expected_structure = _generate_course_structure(course_id)
    update_course_structure(unicode(course_id))
    structure = CourseStructure.objects.get(course_id=course_id)
    self.assertEqual(structure.course_id, course_id)
    self.assertEqual(structure.structure, expected_structure['structure'])
    self.assertEqual(structure.discussion_id_map.keys(), expected_structure['discussion_id_map'].keys())
    self.assertEqual([unicode(value) for value in structure.discussion_id_map.values()], expected_structure['discussion_id_map'].values())
