Commit acc9bca3 by Calen Pennington

Merge pull request #12626 from cpennington/reset-parameters-fake-payment-tests

Reset client post parameters after each payment_fake test, because th…
parents 95054e1a 234ed763
...@@ -15,32 +15,32 @@ class PaymentFakeViewTest(TestCase): ...@@ -15,32 +15,32 @@ class PaymentFakeViewTest(TestCase):
correctly with the shopping cart. correctly with the shopping cart.
""" """
CLIENT_POST_PARAMS = OrderedDict([
('amount', '25.00'),
('currency', 'usd'),
('transaction_type', 'sale'),
('orderNumber', '33'),
('access_key', '123456789'),
('merchantID', 'edx'),
('djch', '012345678912'),
('orderPage_version', 2),
('orderPage_serialNumber', '1234567890'),
('profile_id', "00000001"),
('reference_number', 10),
('locale', 'en'),
('signed_date_time', '2014-08-18T13:59:31Z'),
])
def setUp(self): def setUp(self):
super(PaymentFakeViewTest, self).setUp() super(PaymentFakeViewTest, self).setUp()
# Reset the view state # Reset the view state
PaymentFakeView.PAYMENT_STATUS_RESPONSE = "success" PaymentFakeView.PAYMENT_STATUS_RESPONSE = "success"
self.client_post_params = OrderedDict([
('amount', '25.00'),
('currency', 'usd'),
('transaction_type', 'sale'),
('orderNumber', '33'),
('access_key', '123456789'),
('merchantID', 'edx'),
('djch', '012345678912'),
('orderPage_version', 2),
('orderPage_serialNumber', '1234567890'),
('profile_id', "00000001"),
('reference_number', 10),
('locale', 'en'),
('signed_date_time', '2014-08-18T13:59:31Z'),
])
def test_accepts_client_signatures(self): def test_accepts_client_signatures(self):
# Generate shoppingcart signatures # Generate shoppingcart signatures
post_params = sign(self.CLIENT_POST_PARAMS) post_params = sign(self.client_post_params)
# Simulate a POST request from the payment workflow # Simulate a POST request from the payment workflow
# page to the fake payment page. # page to the fake payment page.
...@@ -58,7 +58,7 @@ class PaymentFakeViewTest(TestCase): ...@@ -58,7 +58,7 @@ class PaymentFakeViewTest(TestCase):
def test_rejects_invalid_signature(self): def test_rejects_invalid_signature(self):
# Generate shoppingcart signatures # Generate shoppingcart signatures
post_params = sign(self.CLIENT_POST_PARAMS) post_params = sign(self.client_post_params)
# Tamper with the signature # Tamper with the signature
post_params['signature'] = "invalid" post_params['signature'] = "invalid"
...@@ -75,7 +75,7 @@ class PaymentFakeViewTest(TestCase): ...@@ -75,7 +75,7 @@ class PaymentFakeViewTest(TestCase):
def test_sends_valid_signature(self): def test_sends_valid_signature(self):
# Generate shoppingcart signatures # Generate shoppingcart signatures
post_params = sign(self.CLIENT_POST_PARAMS) post_params = sign(self.client_post_params)
# Get the POST params that the view would send back to us # Get the POST params that the view would send back to us
resp_params = PaymentFakeView.response_post_params(post_params) resp_params = PaymentFakeView.response_post_params(post_params)
...@@ -90,7 +90,7 @@ class PaymentFakeViewTest(TestCase): ...@@ -90,7 +90,7 @@ class PaymentFakeViewTest(TestCase):
def test_set_payment_status(self): def test_set_payment_status(self):
# Generate shoppingcart signatures # Generate shoppingcart signatures
post_params = sign(self.CLIENT_POST_PARAMS) post_params = sign(self.client_post_params)
# Configure the view to declined payments # Configure the view to declined payments
resp = self.client.put( resp = self.client.put(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment