Skip to content

Commit

Permalink
add a test to ensure that the cm field gets saved in the custom field…
Browse files Browse the repository at this point in the history
… of PDT objects
  • Loading branch information
mthornhill committed May 12, 2009
1 parent 0a0df05 commit d8106e3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion standard/pdt/tests/pdt.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class PDTTest(TestCase):
def setUp(self):
# set up some dummy PDT get parameters
self.get_params = {"tx":"4WJ86550014687441", "st":"Completed", "amt":"225.00", "cc":"EUR",
"cm":"a3e192b8%2d8fea%2d4a86%2db2e8%2dd5bf502e36be", "item_number":"",
"cm":"a3e192b8-8fea-4a86-b2e8-d5bf502e36be", "item_number":"",
"sig":"blahblahblah"}

# monkey patch the PayPalPDT._postback function
Expand Down Expand Up @@ -116,6 +116,16 @@ def test_no_txn_id_in_pdt(self):
paypal_response = self.client.get(reverse('paypal-pdt'), self.get_params)
self.assertContains(paypal_response, 'Transaction Failed', status_code=200)
self.assertEqual(len(PayPalPDT.objects.all()), 0)


def test_custom_passthrough(self):
self.assertEqual(len(PayPalPDT.objects.all()), 0)
self.dpppdt.update_with_get_params(self.get_params)
paypal_response = self.client.get(reverse('paypal-pdt'), self.get_params)
self.assertContains(paypal_response, 'Transaction complete', status_code=200)
self.assertEqual(len(PayPalPDT.objects.all()), 1)
pdt_obj = PayPalPDT.objects.all()[0]
self.assertEqual(pdt_obj.custom, self.get_params['cm'] )



0 comments on commit d8106e3

Please sign in to comment.