From 94be32287e1b71429a7f654ebd9271ec25a7e73f Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Mon, 12 Dec 2016 13:51:16 -0500 Subject: [PATCH 1/4] Convert tabs to whitespace in the test suite --- tests/py/test_notifications.py | 42 ++++++++++++------------- www/~/%username/settings/index.html.spt | 16 ++++++++++ 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/tests/py/test_notifications.py b/tests/py/test_notifications.py index 9fc0a7981a..a9cfdc0e3a 100644 --- a/tests/py/test_notifications.py +++ b/tests/py/test_notifications.py @@ -1,27 +1,27 @@ from gratipay.testing import Harness class TestNotifications(Harness): - def test_add_single_notification(self): - alice = self.make_participant('alice') - alice.add_notification('abcd') - assert alice.notifications == ["abcd"] + def test_add_single_notification(self): + alice = self.make_participant('alice') + alice.add_notification('abcd') + assert alice.notifications == ["abcd"] - def test_add_multiple_notifications(self): - alice = self.make_participant('alice') - alice.add_notification('abcd') - alice.add_notification('1234') - assert alice.notifications == ["abcd", "1234"] + def test_add_multiple_notifications(self): + alice = self.make_participant('alice') + alice.add_notification('abcd') + alice.add_notification('1234') + assert alice.notifications == ["abcd", "1234"] - def test_add_same_notification_twice(self): - alice = self.make_participant('alice') - alice.add_notification('abcd') - alice.add_notification('abcd') - assert alice.notifications == ["abcd"] + def test_add_same_notification_twice(self): + alice = self.make_participant('alice') + alice.add_notification('abcd') + alice.add_notification('abcd') + assert alice.notifications == ["abcd"] - def test_remove_notification(self): - alice = self.make_participant('alice') - alice.add_notification('abcd') - alice.add_notification('1234') - alice.add_notification('bcde') - alice.remove_notification('1234') - assert alice.notifications == ["abcd", "bcde"] + def test_remove_notification(self): + alice = self.make_participant('alice') + alice.add_notification('abcd') + alice.add_notification('1234') + alice.add_notification('bcde') + alice.remove_notification('1234') + assert alice.notifications == ["abcd", "bcde"] diff --git a/www/~/%username/settings/index.html.spt b/www/~/%username/settings/index.html.spt index ce0fb6f2d2..7f1af470d8 100644 --- a/www/~/%username/settings/index.html.spt +++ b/www/~/%username/settings/index.html.spt @@ -44,6 +44,22 @@ emails = participant.get_emails() + {% if user.participant.status_of_1_0_payout == 'pending-application' %} +
+ {% elif user.participant.status_of_1_0_payout in ('pending-review', 'pending-payout') %} +
{{ _( "{nowrap}Check the status of your{_nowrap} {a}1.0 payout application{_a}." + , nowrap=''|safe + , _nowrap=''|safe + , a=''|safe + , _a=''|safe + ) }}
+ {% endif %} From 27e2cc73f43c5ca8eedee52009652b6195e76198 Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Mon, 12 Dec 2016 14:01:19 -0500 Subject: [PATCH 2/4] Add a test for the blog announcement --- tests/py/test_notifications.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/py/test_notifications.py b/tests/py/test_notifications.py index a9cfdc0e3a..cba4ce2c1f 100644 --- a/tests/py/test_notifications.py +++ b/tests/py/test_notifications.py @@ -25,3 +25,6 @@ def test_remove_notification(self): alice.add_notification('bcde') alice.remove_notification('1234') assert alice.notifications == ["abcd", "bcde"] + + def test_blog_announcement(self): + assert 'blog/39c07bd031b">indefinitely' in self.client.GET('/').body From fa1e393a9e2adf7ff090fb825e9a3a4ccd58bd18 Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Mon, 12 Dec 2016 14:41:39 -0500 Subject: [PATCH 3/4] Add /1.0-payout link to settings page --- tests/ttw/test_1_0_payout.py | 36 +++++++++++++++++++++++++ www/~/%username/settings/index.html.spt | 27 ++++++++----------- 2 files changed, 47 insertions(+), 16 deletions(-) create mode 100644 tests/ttw/test_1_0_payout.py diff --git a/tests/ttw/test_1_0_payout.py b/tests/ttw/test_1_0_payout.py new file mode 100644 index 0000000000..ba22f60591 --- /dev/null +++ b/tests/ttw/test_1_0_payout.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +from __future__ import absolute_import, division, print_function, unicode_literals + +from gratipay.testing import BrowserHarness + + +class Tests(BrowserHarness): + + def check(self, status, has_request_button, has_check_button): + self.make_participant('alice', claimed_time='now', status_of_1_0_payout=status) + self.sign_in('alice') + self.visit('/~alice/settings/') + + self.css('.account-details a button') + assert self.has_text('Request 1.0 Payout') is has_request_button + + self.css('.account-details a button') + assert self.has_text('Check 1.0 Payout') is has_check_button + + def test_too_little_has_neither(self): + self.check('too-little', False, False) + + def test_pending_application_has_request_button(self): + self.check('pending-application', True, False) + + def test_pending_review_has_check_button(self): + self.check('pending-review', False, True) + + def test_rejected_has_neither(self): + self.check('rejected', False, False) + + def test_pending_payout_has_check_button(self): + self.check('pending-payout', False, True) + + def test_pending_completed_has_neither(self): + self.check('completed', False, False) diff --git a/www/~/%username/settings/index.html.spt b/www/~/%username/settings/index.html.spt index 7f1af470d8..e15469ee62 100644 --- a/www/~/%username/settings/index.html.spt +++ b/www/~/%username/settings/index.html.spt @@ -44,23 +44,18 @@ emails = participant.get_emails() - {% if user.participant.status_of_1_0_payout == 'pending-application' %} -
- {% elif user.participant.status_of_1_0_payout in ('pending-review', 'pending-payout') %} -
{{ _( "{nowrap}Check the status of your{_nowrap} {a}1.0 payout application{_a}." - , nowrap=''|safe - , _nowrap=''|safe - , a=''|safe - , _a=''|safe - ) }}
- {% endif %} + {% if user.participant.status_of_1_0_payout.startswith('pending-') %} + + + {% if user.participant.status_of_1_0_payout == 'pending-application' %} + {{ _( "Request 1.0 Payout") }} + {% elif user.participant.status_of_1_0_payout in ('pending-review', 'pending-payout') %} + {{ _( "Check 1.0 Payout") }} + {% endif %} + + + {% endif %} From 8e0e9c1ecd37946deb619d2b78fcd348810ef8a6 Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Mon, 12 Dec 2016 14:48:31 -0500 Subject: [PATCH 4/4] Update announcement: new Terms! --- templates/base.html | 23 +++-------------------- tests/py/test_notifications.py | 2 +- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/templates/base.html b/templates/base.html index d266d537cb..46b251f2f5 100644 --- a/templates/base.html +++ b/templates/base.html @@ -66,36 +66,19 @@

{{ banner }}

{% endif %}{% endblock %}
- {% if request.path.raw != '/1.0-payout' %} - {% if not user.participant or user.participant.status_of_1_0_payout == 'pending-application' %} -
{{ _( "{nowrap}{a}1.0 payouts{_a} are{_nowrap} {nowrap}available {a2}indefinitely{_a}{_nowrap}." + {{ _( "{nowrap}Our new {a}Terms of Service{_a}{_nowrap} {nowrap}make it {a2}easier to join Gratipay{_a}{_nowrap}." , nowrap=''|safe , _nowrap=''|safe - , a=''|safe - , a2=''|safe + , a=''|safe + , a2=''|safe , _a=''|safe ) }}
- {% elif user.participant and user.participant.status_of_1_0_payout in ('pending-review', 'pending-payout') %} - - - - - - -
{{ _( "{nowrap}Check the status of your{_nowrap} {a}1.0 payout application{_a}." - , nowrap=''|safe - , _nowrap=''|safe - , a=''|safe - , _a=''|safe - ) }}
- {% endif %} - {% endif %}
{% block main %} diff --git a/tests/py/test_notifications.py b/tests/py/test_notifications.py index cba4ce2c1f..549e69bc48 100644 --- a/tests/py/test_notifications.py +++ b/tests/py/test_notifications.py @@ -27,4 +27,4 @@ def test_remove_notification(self): assert alice.notifications == ["abcd", "bcde"] def test_blog_announcement(self): - assert 'blog/39c07bd031b">indefinitely' in self.client.GET('/').body + assert 'projects-45c46718507b">easier' in self.client.GET('/').body