'Import a course from XML, then verify that the XBlock was loaded
with the correct field value.
Args:
course_dir (str): The name of the course directory (relative to the test data directory)
expected_xblock_loc (str): The location of the XBlock in the course.
expected_field_val (str): The expected value of the XBlock\'s test field.
Kwargs:
has_draft (bool): If true, check that a draft of the XBlock exists with
the expected field value set.'

def _assert_import(self, course_dir, expected_field_val, has_draft=False):

    store = modulestore()._get_modulestore_by_type(ModuleStoreEnum.Type.mongo)
    courses = import_course_from_xml(store, self.user.id, TEST_DATA_DIR, [course_dir], create_if_not_present=True)
    xblock_location = courses[0].id.make_usage_key('stubxblock', 'xblock_test')
    if has_draft:
        xblock_location = as_draft(xblock_location)
    xblock = store.get_item(xblock_location)
    self.assertTrue(isinstance(xblock, StubXBlock))
    self.assertEqual(xblock.test_field, expected_field_val)
    if has_draft:
        draft_xblock = store.get_item(xblock_location)
        self.assertTrue(getattr(draft_xblock, 'is_draft', False))
        self.assertTrue(isinstance(draft_xblock, StubXBlock))
        self.assertEqual(draft_xblock.test_field, expected_field_val)
