Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix amazon fps tests; make them easy to maintain
fixed bitcoin gateway tests fixed braintree tests; make it easier to debug fixed google checkout tests fixed worldpay tests; removed html fixtures skip paylane tests if not configured
- Loading branch information
Showing
7 changed files
with
123 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,38 @@ | ||
import re | ||
from urllib2 import urlparse | ||
|
||
from django.test import TestCase | ||
from billing import get_integration | ||
from django.template import Template, Context | ||
from django.conf import settings | ||
|
||
from billing import get_integration | ||
|
||
|
||
class AmazonFPSTestCase(TestCase): | ||
urls = "billing.tests.test_urls" | ||
|
||
def setUp(self): | ||
self.fps = get_integration("amazon_fps") | ||
fields = { | ||
self.fields = { | ||
"callerReference": "100", | ||
"paymentReason": "Digital Download", | ||
"pipelineName": "SingleUse", | ||
"transactionAmount": 30, | ||
"transactionAmount": '30', | ||
"returnURL": "http://localhost/fps/fps-return-url/", | ||
} | ||
self.fps.add_fields(fields) | ||
} | ||
self.fps.add_fields(self.fields) | ||
|
||
def testLinkGen(self): | ||
tmpl = Template("{% load amazon_fps from amazon_fps_tags %}{% amazon_fps obj %}") | ||
link = tmpl.render(Context({"obj": self.fps})) | ||
pregen_link = """<a href="https://authorize.payments-sandbox.amazon.com/cobranded-ui/actions/start?callerKey=%(aws_access_key)s&callerReference=100&paymentReason=Digital%%20Download&pipelineName=SingleUse&returnURL=http%%3A%%2F%%2Flocalhost%%2Ffps%%2Ffps-return-url%%2F&signature=oSnkew7oCBPVk0IVZAjO87Ogsp4EO7jRlELaFwtqWzY%%3D&signatureMethod=HmacSHA256&signatureVersion=2&transactionAmount=30"><img src="http://g-ecx.images-amazon.com/images/G/01/cba/b/p3.gif" alt="Amazon Payments" /></a>""" % ({"aws_access_key": settings.MERCHANT_SETTINGS['amazon_fps']['AWS_ACCESS_KEY']}) | ||
self.assertEquals(pregen_link, link.strip()) | ||
# get the integration link url | ||
url = re.search('href="(.*)">', link).groups()[0] | ||
parsed = urlparse.urlparse(url) | ||
query_dict = dict(urlparse.parse_qsl(parsed.query)) | ||
|
||
self.assertEquals(parsed.scheme, 'https') | ||
self.assertEquals(parsed.netloc, 'authorize.payments-sandbox.amazon.com') | ||
self.assertEquals(parsed.path, '/cobranded-ui/actions/start') | ||
|
||
self.assertDictContainsSubset(self.fields, query_dict) | ||
self.assertEquals(query_dict['callerKey'], settings.MERCHANT_SETTINGS['amazon_fps']['AWS_ACCESS_KEY']) |
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
Oops, something went wrong.