def test_invalid_decryption(self): request = testing.DummyRequest() request.json_body = { 'iv': '27CD0D0CA9379D32'.encode('base64'), 'notification': 'bar4567890123456'.encode('base64'), } view = IPNView(request) with self.assertRaises(ValueError) as cm: view.clickbank() self.assertIn('Decryption failed: ', cm.exception.message)
def test_no_JSON(self): request = testing.DummyRequest() view = IPNView(request) with self.assertRaises(ValueError) as cm: view.clickbank() self.assertEqual(cm.exception.message, 'No JSON request.')