Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Shelve
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Sep 9, 2017
1 parent 982f75c commit 14f22fb
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 14 deletions.
31 changes: 31 additions & 0 deletions tests/ttw/test_homepage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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', '[email protected]',
'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', '[email protected]',
'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'
26 changes: 12 additions & 14 deletions www/index.spt
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,21 @@ $(document).ready(function() {
<div id="braintree-container"></div>
</fieldset>

<fieldset>
<legend>{{ _('Step 2 of 3') }}</legend>
<fieldset class="optional">
<legend>{{ _('Optional') }}</legend>

<h2>{{ _('Who are you?') }}</h2>

<div class="field">
<label for="name">{{ _('Your Name') }}</label>
<input name="name" id="name" type="text" required>
<input name="name" id="name" type="text">
</div>

<div class="field email-address">
<label for="email-address">{{ _('Your Email Address') }}</label>
<input name="email-address" id="email-address" type="text" required>
<input name="email-address" id="email-address" type="text">
<p class="fine-print">
{{ _('You will get a verification link before we finalize your payment.') }}
{{ _('You will get a receipt for your payment.') }}
</p>
</div>

Expand Down Expand Up @@ -109,10 +110,7 @@ $(document).ready(function() {
</p>
</fieldset>
</div>
</fieldset>

<fieldset class="optional">
<legend>{{ _('Optional') }}</legend>
<h2>{{ _('Ecosystems') }}</h2>
<p class="fine-print">
{{ _('Which do you value most?{br}(JavaScript, Python, etc.)', br='<br>'|safe) }}
Expand All @@ -131,22 +129,22 @@ $(document).ready(function() {

<div class="field">
<label label="company">{{ _("Your Company Name") }}</label>
<input type="text" name="promote-name" id="promote-name">
<input type="text" name="promotion-name" id="promotion-name">
</div>

<div class="field">
<label label="company">{{ _("Your Landing Page URL") }}</label>
<input type="text" name="promote-url" id="promote-url">
<input type="text" name="promotion-url" id="promotion-url">
</div>

<div class="field">
<label label="company">{{ _("Your Company Twitter Handle") }}</label>
<input type="text" name="promote-twitter" id="promote-twitter">
<input type="text" name="promotion-twitter" id="promote-twitter">
</div>

<div class="field">
<label label="company">{{ _("Your Message to the Open Source Community") }}</label>
<input type="text" name="promote-message" id="promote-message">
<input type="text" name="promotion-message" id="promote-message">
</div>
</div>

Expand All @@ -157,11 +155,11 @@ $(document).ready(function() {

</fieldset>

<fieldset>
<fieldset class="submit">
<legend>{{ _('Submit Form') }}</legend>

<div class="important-button">
<button type="submit" class="apply selected large">
<button type="submit" class="selected large">
{{ _("Pay for Open Source") }}
</button>
</div>
Expand Down

0 comments on commit 14f22fb

Please sign in to comment.