test_donation.py 963 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. from conftest import DeSECAPIV1Client
  2. import pytest
  3. from pytest_schema import schema, Optional
  4. donation = {
  5. 'name': str,
  6. 'iban': str,
  7. 'bic': str,
  8. 'amount': str,
  9. 'mref': str,
  10. 'interval': int,
  11. 'message': str,
  12. 'email': str,
  13. }
  14. @pytest.mark.parametrize("data", [
  15. {
  16. "name": "Drama Queen",
  17. "iban": "DE89 3704 0044 0532 0130 00",
  18. "bic": "MARKDEF1100",
  19. "amount": "3.14",
  20. "message": "foobar",
  21. "email": "drama@queen.world",
  22. },
  23. {
  24. "name": "Drama Queen",
  25. "iban": "DE89370400440532013000",
  26. "bic": "MARKDEF1100",
  27. "amount": "3.14",
  28. },
  29. ])
  30. def test_response(api_anon: DeSECAPIV1Client, data):
  31. response = api_anon.post("/donation/", data=data)
  32. assert response.status_code == 201
  33. assert schema(donation, ignore_extra_keys=False) == response.json()
  34. @pytest.mark.skip(reason="not sure how to test")
  35. def test_confirmation_email():
  36. pass