'Test that deleting the last PUBLIC version but there is an APPROVED
version marks the app as APPROVED.
Similar to the above test but ensures APPROVED versions don\'t get
confused with PUBLIC versions.'

def test_delete_last_public_version(self):

    eq_(self.app.versions.count(), 1)
    ver1 = self.app.latest_version
    ver1.all_files[0].update(status=mkt.STATUS_APPROVED)
    ver2 = version_factory(addon=self.app, version='2.0', file_kw=dict(status=mkt.STATUS_PUBLIC))
    self.client.post(self.delete_url, {'version_id': ver2.pk})
    self.app.reload()
    eq_(self.app.status, mkt.STATUS_APPROVED)
    eq_(self.app.latest_version, ver1)
    eq_(self.app.current_version, None)
    eq_(self.app.versions.count(), 1)
    eq_(Version.with_deleted.get(pk=ver2.pk).all_files[0].status, mkt.STATUS_DISABLED)
