'Test that when we override Scope.settings values in a course,
the override values persist even when the block is refreshed
with updated blocks from the library.'

@ddt.data(False, True)
def test_persistent_overrides(self, duplicate):

    new_display_name = 'Modified    Problem    Title'
    new_weight = 15
    self.problem_in_course.display_name = new_display_name
    self.problem_in_course.weight = new_weight
    modulestore().update_item(self.problem_in_course, self.user.id)
    if duplicate:
        self.lc_block = modulestore().get_item(_duplicate_item(self.course.location, self.lc_block.location, self.user))
        self.problem_in_course = modulestore().get_item(self.lc_block.children[0])
    else:
        self.problem_in_course = modulestore().get_item(self.problem_in_course.location)
    self.assertEqual(self.problem_in_course.display_name, new_display_name)
    self.assertEqual(self.problem_in_course.weight, new_weight)
    self.problem.display_name = 'X'
    self.problem.weight = 99
    new_data_value = '<problem><p>Changed    data    to    check    that    non-overriden    fields    *do*    get    updated.</p></problem>'
    self.problem.data = new_data_value
    modulestore().update_item(self.problem, self.user.id)
    self.lc_block = self._refresh_children(self.lc_block)
    self.problem_in_course = modulestore().get_item(self.problem_in_course.location)
    self.assertEqual(self.problem_in_course.display_name, new_display_name)
    self.assertEqual(self.problem_in_course.weight, new_weight)
    self.assertEqual(self.problem_in_course.data, new_data_value)
