diff --git a/tests/ttw/test_homepage.py b/tests/ttw/test_homepage.py index bcfb1dbe7b..ec474fbc21 100644 --- a/tests/ttw/test_homepage.py +++ b/tests/ttw/test_homepage.py @@ -5,6 +5,23 @@ class Tests(BrowserHarness): + def fill_form(self, amount, credit_card_number, expiration, cvv, name, email_address, + follow_up, promotion_name, promotion_url, promotion_twitter, promotion_message): + self.wait_for('.braintree-form-number') + self.fill('amount', amount) + with self.get_iframe('braintree-hosted-field-number') as iframe: + iframe.fill('credit-card-number', '4242424242424242') + self.fill('name', name) + self.fill('email-address', email_address) + if promotion_name: + self.css('.promotion-gate button').type('\n') + # stackoverflow.com/q/11908249#comment58577676_19763087 + self.fill('promotion-name', promotion_name) + self.fill('promotion-url', promotion_url) + self.fill('promotion-twitter', promotion_twitter) + self.fill('promotion-message', promotion_message) + + def test_loads_for_anon(self): assert self.css('#banner h1').html == 'Pay for open source.' assert self.css('#header .sign-in button').html.strip()[:17] == 'Sign in / Sign up' @@ -15,3 +32,17 @@ def test_redirects_for_authed_exclamation_point(self): self.reload() assert self.css('#banner h1').html == 'Browse' assert self.css('.you-are a').html.strip()[:6] == '~alice' + + def test_anon_can_post(self): + self.fill_form('537', '4242424242424242', '', '', 'Alice Liddell', 'alice@example.com', + 'monthly', 'Wonderland', 'http://www.example.com/', 'thebestbutter', + 'Love me! Love me! Say that you love me!') + self.css('fieldset.submit button').type('\n') + assert self.db.one('select * from moral_license_payments').promotion_name == 'Wonderland' + + def est_validation_works(self): + self.fill_form('537', '4242424242424242', '', '', 'Alice Liddell', 'alice@example.com', + 'monthly', 'Wonderland', 'http://www.example.com/', 'thebestbutter', + 'Love me! Love me! Say that you love me!') + self.css('fieldset.submit button').type('\n') + assert self.db.one('select * from moral_license_payments').promotion_name == 'Wonderland' diff --git a/www/index.spt b/www/index.spt index 73015fa217..3759a76041 100644 --- a/www/index.spt +++ b/www/index.spt @@ -62,20 +62,21 @@ $(document).ready(function() {
-
- {{ _('Step 2 of 3') }} +
+ {{ _('Optional') }} +

{{ _('Who are you?') }}

- +
@@ -109,10 +110,7 @@ $(document).ready(function() {

-
-
- {{ _('Optional') }}

{{ _('Ecosystems') }}

{{ _('Which do you value most?{br}(JavaScript, Python, etc.)', br='
'|safe) }} @@ -131,22 +129,22 @@ $(document).ready(function() {

- +
- +
- +
- +
@@ -157,11 +155,11 @@ $(document).ready(function() {
-
+
{{ _('Submit Form') }}
-