Merge pull request #4494 from diox/no-so-incomplete-after-all

Adjust "incomplete" wording in devhub addons dashboard
This commit is contained in:
Mathieu Pillard 2017-01-27 15:32:53 +01:00 коммит произвёл GitHub
Родитель 35ecf881cb a358dfb099
Коммит 76b52309d6
3 изменённых файлов: 52 добавлений и 15 удалений

Просмотреть файл

@ -5,17 +5,20 @@
<div class="item addon ignore-compatibility" data-addonid="{{ addon.id }}">
<div class="info">
{{ dev_heading(addon, amo) }}
{% if not addon.has_complete_metadata() and addon.status == amo.STATUS_NULL %}
{% if addon.status == amo.STATUS_NULL and not addon.has_complete_metadata() %}
<p class="incomplete">
{% trans %}
This add-on will be deleted automatically after a few days if
the submission process is not completed.
{% endtrans %}
{{ _('This add-on is missing some required information before it can be submitted for publication.') }}
</p>
{% elif addon.status == amo.STATUS_NULL and not addon.has_unlisted_versions() and not addon.has_listed_versions() %}
<p class="incomplete">
{{ _("This add-on doesn't have any versions.")}}
</p>
{% else %}
<div class="item-info">
{{ dev_item_info(addon, amo) }}
</div>
{% if addon.status != amo.STATUS_NULL or addon.has_listed_versions() %}
<div class="item-info">
{{ dev_item_info(addon, amo) }}
</div>
{% endif %}
<ul class="item-details">
{% if addon.is_persona() %}
{# L10n: {0} is a date. #}

Просмотреть файл

@ -210,7 +210,7 @@ class TestActivity(HubTest):
self.get_response(addon=self.addon.id)
key = RssKey.objects.get()
response = self.get_response(privaterss=key.key)
assert len(pq(response.content)('item')) == 5
assert len(pq(response.content)('item')) == 6
def test_logged_out(self):
self.client.logout()
@ -234,7 +234,7 @@ class TestActivity(HubTest):
self.make_addon_unlisted(self.addon)
self.log_creates(1)
doc = self.get_pq()
assert len(doc('.item')) == 1
assert len(doc('.item')) == 2
assert '<script>' not in unicode(doc), 'XSS FTL'
assert '&lt;script&gt;' in unicode(doc), 'XSS FTL'
@ -249,7 +249,7 @@ class TestActivity(HubTest):
self.make_addon_unlisted(self.addon)
self.log_collection(1, "<script>alert('v1@gra for u')</script>")
doc = self.get_pq()
assert len(doc('.item')) == 1
assert len(doc('.item')) == 2
assert '<script>' not in unicode(doc), 'XSS FTL'
assert '&lt;script&gt;' in unicode(doc), 'XSS FTL'
@ -264,14 +264,14 @@ class TestActivity(HubTest):
self.make_addon_unlisted(self.addon)
self.log_tag(1, "<script src='x.js'>")
doc = self.get_pq()
assert len(doc('.item')) == 1
assert len(doc('.item')) == 2
assert '<script' not in unicode(doc('.item')), 'XSS FTL'
assert '&lt;script' in unicode(doc('.item')), 'XSS FTL'
def test_xss_versions(self):
self.log_updates(1, "<script src='x.js'>")
doc = self.get_pq()
assert len(doc('.item')) == 2
assert len(doc('.item')) == 1
assert '<script' not in unicode(doc('.item')), 'XSS FTL'
assert '&lt;script' in unicode(doc('.item')), 'XSS FTL'

Просмотреть файл

@ -23,7 +23,7 @@ from olympia.amo.tests import TestCase
from olympia.addons.models import (
Addon, AddonFeatureCompatibility, Charity)
from olympia.amo.helpers import url as url_reverse
from olympia.amo.tests import addon_factory
from olympia.amo.tests import addon_factory, version_factory
from olympia.amo.tests.test_helpers import get_image_path
from olympia.amo.urlresolvers import reverse
from olympia.api.models import APIKey, SYMMETRIC_JWT_TYPE
@ -58,7 +58,7 @@ class HubTest(TestCase):
'status': addon.status,
'name': 'cloned-addon-%s-%s' % (addon_id, i)
}
new_addon = Addon.objects.create(**data)
new_addon = addon_factory(**data)
new_addon.addonuser_set.create(user=self.user_profile)
ids.append(new_addon.id)
return ids
@ -292,6 +292,40 @@ class TestDashboard(HubTest):
assert elm.remove('strong').text() == (
trim_whitespace(datetime_filter(addon.created)))
def test_purely_unlisted_addon_are_not_shown_as_incomplete(self):
self.make_addon_unlisted(self.addon)
assert self.addon.has_complete_metadata()
response = self.client.get(self.url)
doc = pq(response.content)
# It should not be considered incomplete despite having STATUS_NULL,
# since it's purely unlisted.
assert not doc('.incomplete')
# Rest of the details should be shown, but not the AMO-specific stuff.
assert not doc('.item-info')
assert doc('.item-details')
def test_mixed_versions_addon_with_incomplete_metadata(self):
self.make_addon_unlisted(self.addon)
version_factory(addon=self.addon, channel=amo.RELEASE_CHANNEL_LISTED)
self.addon.reload()
assert not self.addon.has_complete_metadata()
response = self.client.get(self.url)
doc = pq(response.content)
assert doc('.incomplete').text() == (
'This add-on is missing some required information before it can be'
' submitted for publication.')
def test_no_versions_addon(self):
self.addon.versions.all().delete()
response = self.client.get(self.url)
doc = pq(response.content)
assert doc('.incomplete').text() == (
"This add-on doesn't have any versions.")
class TestUpdateCompatibility(TestCase):
fixtures = ['base/users', 'base/addon_4594_a9', 'base/addon_3615']