'Test the branch setting context manager'

def test_branch_setting(self):

    store = XMLModuleStore(DATA_DIR, source_dirs=['toy'])
    course = store.get_courses()[0]
    with store.branch_setting(ModuleStoreEnum.Branch.published_only, course.id):
        store.get_item(course.location)
    with self.assertRaises(ValueError):
        with store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, course.id):
            pass
