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
bfa6e0b
commit 5237a29
Showing
2 changed files
with
43 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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', '[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' |
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