Esempio n. 1
0
 def test_treat_binary_string(self):
     safe_payment = notifications.treat(b'{"id": "pay_test_unsafe", "object": "payment"}')
     assert safe_payment.id == 'pay_test'
Esempio n. 2
0
 def test_treat_unknown_api_resource(self):
     with pytest.raises(exceptions.UnknownAPIResource):
         notifications.treat('{"id": "payment_id", "object": "bouillabaisse"}')
Esempio n. 3
0
 def test_treat_invalide_api_resource(self):
     with pytest.raises(exceptions.UnknownAPIResource) as excinfo:
         notifications.treat('{"this_resource": "has_no_id", "object": "payment"}')
     assert str(excinfo.value) == 'The API resource provided is invalid.'
Esempio n. 4
0
 def test_treat_invalid_json(self):
     with pytest.raises(exceptions.UnknownAPIResource) as excinfo:
         notifications.treat('"malformed JSON')
     assert str(excinfo.value) == 'Request body is malformed JSON.'
 def test_treat_binary_string(self):
     safe_payment = notifications.treat(b'{"id": "pay_test_unsafe", "object": "payment"}')
     assert safe_payment.id == 'pay_test'
 def test_treat_invalid_api_resource(self):
     with pytest.raises(exceptions.UnknownAPIResource) as excinfo:
         notifications.treat('{"this_resource": "has_no_id", "object": "payment"}')
     assert str(excinfo.value) == 'The API resource provided is invalid.'
 def test_treat_unknown_api_resource(self):
     with pytest.raises(exceptions.UnknownAPIResource):
         notifications.treat('{"id": "payment_id", "object": "bouillabaisse"}')
 def test_treat_invalid_json(self):
     with pytest.raises(exceptions.UnknownAPIResource) as excinfo:
         notifications.treat('"malformed JSON')
     assert str(excinfo.value) == 'Request body is malformed JSON.'