'Test publishing when the only version of the app is approved
doesn\'t change the app status.'

@mock.patch('mkt.webapps.tasks.index_webapps')
@mock.patch('mkt.webapps.tasks.update_cached_manifests')
@mock.patch('mkt.webapps.models.Webapp.update_supported_locales')
@mock.patch('mkt.webapps.models.Webapp.update_name_from_package_manifest')
def test_publicise_version_cur_approved(self, update_name, update_locales, update_cached_manifests, index_webapps):

    self.app.update(status=mkt.STATUS_APPROVED)
    File.objects.filter(version__addon=self.app).update(status=mkt.STATUS_APPROVED)
    eq_(self.app.current_version, self.app.latest_version)
    index_webapps.delay.reset_mock()
    eq_(update_name.call_count, 0)
    eq_(update_locales.call_count, 0)
    eq_(update_cached_manifests.delay.call_count, 0)
    res = self.post()
    eq_(res.status_code, 302)
    eq_(self.app.current_version, self.app.latest_version)
    eq_(self.get_latest_version_status(), mkt.STATUS_PUBLIC)
    eq_(self.app.reload().status, mkt.STATUS_APPROVED)
    eq_(update_name.call_count, 1)
    eq_(update_locales.call_count, 1)
    eq_(update_cached_manifests.delay.call_count, 0)
