This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
982f75c
commit 3e13478
Showing
6 changed files
with
112 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,28 @@ | |
|
||
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', credit_card_number) | ||
with self.get_iframe('braintree-hosted-field-expirationDate') as iframe: | ||
iframe.fill('expiration', expiration) | ||
with self.get_iframe('braintree-hosted-field-cvv') as iframe: | ||
iframe.fill('cvv', cvv) | ||
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.wait_for('#promotion-message') | ||
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 +37,18 @@ 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', '1020', '123', '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') | ||
import pdb; pdb.set_trace() | ||
assert self.db.one('SELECT * FROM payments_for_open_source').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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters