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,7 +15,13 @@ class PaymentFakeViewTest(TestCase): ...@@ -15,7 +15,13 @@ class PaymentFakeViewTest(TestCase):
correctly with the shopping cart. correctly with the shopping cart.
""" """
CLIENT_POST_PARAMS = OrderedDict([ def setUp(self):
super(PaymentFakeViewTest, self).setUp()
# Reset the view state
PaymentFakeView.PAYMENT_STATUS_RESPONSE = "success"
self.client_post_params = OrderedDict([
('amount', '25.00'), ('amount', '25.00'),
('currency', 'usd'), ('currency', 'usd'),
('transaction_type', 'sale'), ('transaction_type', 'sale'),
...@@ -31,16 +37,10 @@ class PaymentFakeViewTest(TestCase): ...@@ -31,16 +37,10 @@ class PaymentFakeViewTest(TestCase):
('signed_date_time', '2014-08-18T13:59:31Z'), ('signed_date_time', '2014-08-18T13:59:31Z'),
]) ])
def setUp(self):
super(PaymentFakeViewTest, self).setUp()
# Reset the view state
PaymentFakeView.PAYMENT_STATUS_RESPONSE = "success"
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