diff --git a/tests/ttw/test_package_discovery.py b/tests/ttw/test_package_discovery.py index 46d581d696..64e68ffa53 100644 --- a/tests/ttw/test_package_discovery.py +++ b/tests/ttw/test_package_discovery.py @@ -20,16 +20,21 @@ def test_pasting_a_package_json_works(self): self.make_package(name='amperize', description='Amperize!') glob = self.make_package(name='glob', description='Glob!', emails=['bob@example.com']) self.make_package(name='netjet', description='Netjet!', emails=['cat@example.com']) + scape = self.make_package(name='scape', description='Reject!', emails=['goat@example.com']) self.claim_package(self.make_participant('alice'), 'amperize') self.claim_package(self.make_participant('bob'), 'glob') + self.claim_package(self.make_participant('goat'), 'scape') + admin = self.make_admin() glob.team.update(name='Glub') + glob.team.update_review_status('approved', admin) + scape.team.update_review_status('rejected', admin) self.sign_in('alice') self.visit('/on/npm/') self.css('textarea').fill('''\ - { "dependencies": { "glob": "..." , "amperize": "..."} + { "dependencies": { "glob": "..." , "amperize": "...", "scape": "..."} , "optionalDependencies": {"netjet": "...", "falafel": "..."} } @@ -37,7 +42,10 @@ def test_pasting_a_package_json_works(self): self.css('form button').click() names = [x.text for x in self.css('.listing-name')] - assert names == ['glob \u2192 Glub', 'amperize', 'netjet', 'falafel'] + assert names == ['glob \u2192 Glub', 'amperize', 'scape', 'netjet', 'falafel'] + + statuses = [x.text[3:] for x in self.css('.listing-details .status')] + assert statuses == ['Approved', 'Unreviewed', 'Rejected', 'Unclaimed'] enabled = [not x.has_class('disabled') for x in self.css('td.item')] - assert enabled == [True, True, True, False] + assert enabled == [True, True, True, True, False] diff --git a/www/on/npm/index.html.spt b/www/on/npm/index.html.spt index ea7d0f2896..afaf07ff85 100644 --- a/www/on/npm/index.html.spt +++ b/www/on/npm/index.html.spt @@ -15,6 +15,13 @@ if user.participant: packages_for_claiming = user.participant.get_packages_for_claiming(manager) any_claimable = any([rec.claimed_by is None for rec in packages_for_claiming]) +# Can't factor this out because of translations? +i18ned_statuses = { "approved": _("Approved") + , "unreviewed" : _("Unreviewed") + , "rejected": _("Rejected") + , "featured": _("Featured") + } + flow = request.qs.get('flow') i18ned_flows = {'pay': _('Pay'), 'receive' : _('Receive')} tab_html = lambda key, tab: '{}'.format(i18ned_flows[key]) @@ -130,8 +137,23 @@ if request.method == 'POST':
{{ i }} · {{ group }} + {% if project %} + · + {{ icons.STATUS_ICONS[icons.REVIEW_MAP[project.status]]|safe }}{{ i18ned_statuses[project.status] }} + + {% elif package %} + · + {{ icons.STATUS_ICONS[icons.REVIEW_MAP['rejected']]|safe }}{{ _("Unclaimed") }} + + {% endif %} + · - {{ package.description or _('unknown package') }} + {{ package.description or _("Unknown package") }}