Commit 234ed763 by Calen Pennington

Reset client post parameters after each payment_fake test, because the sign…

Reset client post parameters after each payment_fake test, because the sign method modifies the supplied dictionary
parent 387f968c
......@@ -15,32 +15,32 @@ class PaymentFakeViewTest(TestCase):
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):
super(PaymentFakeViewTest, self).setUp()
# Reset the view state
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):
# 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
# page to the fake payment page.
......@@ -58,7 +58,7 @@ class PaymentFakeViewTest(TestCase):
def test_rejects_invalid_signature(self):
# Generate shoppingcart signatures
post_params = sign(self.CLIENT_POST_PARAMS)
post_params = sign(self.client_post_params)
# Tamper with the signature
post_params['signature'] = "invalid"
......@@ -75,7 +75,7 @@ class PaymentFakeViewTest(TestCase):
def test_sends_valid_signature(self):
# 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
resp_params = PaymentFakeView.response_post_params(post_params)
......@@ -90,7 +90,7 @@ class PaymentFakeViewTest(TestCase):
def test_set_payment_status(self):
# Generate shoppingcart signatures
post_params = sign(self.CLIENT_POST_PARAMS)
post_params = sign(self.client_post_params)
# Configure the view to declined payments
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