'Test calling unpublish'

@ddt.data((ModuleStoreEnum.Type.mongo, 2, 6), (ModuleStoreEnum.Type.split, 3, 2))
@ddt.unpack
def test_unpublish(self, default_ms, max_find, max_send):

    self.initdb(default_ms)
    if ((default_ms == ModuleStoreEnum.Type.mongo) and mongo_uses_error_check(self.store)):
        max_find += 1
    self._create_block_hierarchy()
    self.store.publish(self.course.location, self.user_id)
    published_xblock = self.store.get_item(self.vertical_x1a, revision=ModuleStoreEnum.RevisionOption.published_only)
    self.assertIsNotNone(published_xblock)
    with check_mongo_calls(max_find, max_send):
        self.store.unpublish(self.vertical_x1a, self.user_id)
    with self.assertRaises(ItemNotFoundError):
        self.store.get_item(self.vertical_x1a, revision=ModuleStoreEnum.RevisionOption.published_only)
    draft_xblock = self.store.get_item(self.vertical_x1a, revision=ModuleStoreEnum.RevisionOption.draft_only)
    self.assertIsNotNone(draft_xblock)
