'Tests that if there are orphans only on the published branch,
running delete orphans with a course key that specifies
the published branch will delete the published orphan'

def test_delete_orphans_published_branch_split(self):

    (course, orphan) = self.create_split_course_with_published_orphan()
    published_branch = course.id.for_branch(ModuleStoreEnum.BranchName.published)
    items_in_published = self.store.get_items(published_branch)
    items_in_draft_preferred = self.store.get_items(course.id)
    call_command('delete_orphans', unicode(published_branch), '--commit')
    self.assertOrphanCount(course.id, 0)
    self.assertOrphanCount(published_branch, 0)
    self.assertNotIn(orphan, self.store.get_items(published_branch))
    self.assertEqual((len(items_in_published) - 1), len(self.store.get_items(published_branch)))
    self.assertEqual(len(items_in_draft_preferred), len(self.store.get_items(course.id)))
