'Test create_course with a specified root id and category'

def test_create_with_root(self):

    user = random.getrandbits(32)
    new_course = modulestore().create_course('test_org', 'test_transaction', 'test_run', user, BRANCH_NAME_DRAFT, root_block_id='top', root_category='chapter')
    self.assertEqual(new_course.location.block_id, 'top')
    self.assertEqual(new_course.category, 'chapter')
    db_structure = modulestore().db_connection.get_structure(new_course.location.as_object_id(new_course.location.version_guid))
    self.assertIsNotNone(db_structure, "Didn't    find    course")
    self.assertNotIn(BlockKey('course', 'course'), db_structure['blocks'])
    self.assertIn(BlockKey('chapter', 'top'), db_structure['blocks'])
    self.assertEqual(db_structure['blocks'][BlockKey('chapter', 'top')].block_type, 'chapter')
