'This tests that an app with a prior pending version that got
deleted doesn\'t trigger the app to remain in the review queue.'

def test_deleted_version_not_in_queue(self):

    app = self.apps[0]
    old_ver = app.versions.order_by('id')[0]
    old_ver.files.latest().update(status=mkt.STATUS_PENDING)
    old_ver.delete()
    app.versions.latest().files.latest().update(status=mkt.STATUS_PUBLIC)
    eq_(app.reload().status, mkt.STATUS_PUBLIC)
    if self.uses_es():
        self.reindex(Webapp)
    res = self.client.get(self.url)
    eq_(res.status_code, 200)
    eq_(Version.with_deleted.filter(addon=app).count(), 2)
    doc = pq(res.content)
    eq_(doc('.tabnav    li    a')[2].text, u'Updates    (1)')
    apps = [a.app.id for a in res.context['addons']]
    ok_((app.id not in apps))
    ok_((self.apps[1].id in apps))
