Skip to content

Commit

Permalink
Replace deprecated 'match_querystring' in responses with updated cons…
Browse files Browse the repository at this point in the history
…truct.
  • Loading branch information
Tom Hendrikx committed Apr 5, 2022
1 parent ca38839 commit 58776c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ pytest-isort
pytest-flake8
pytest-mock
mock
responses
responses>=0.17.0
safety
5 changes: 3 additions & 2 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import pytest
import requests.adapters
from responses import matchers

from mollie.api.client import Client, generate_querystring
from mollie.api.error import (
Expand Down Expand Up @@ -42,9 +43,9 @@ def test_client_querystring(client, response):
"""Verify that we are triggering the correct URL when using querystring with square brackets."""
response.add(
response.GET,
"https://api.mollie.com/v2/methods?amount[currency]=USD&amount[value]=100.00",
"https://api.mollie.com/v2/methods",
body=response._get_body("methods_list"),
match_querystring=True,
match=[matchers.query_string_matcher("amount%5Bvalue%5D=100.00&amount%5Bcurrency%5D=USD")],
)

params = {"amount": {"currency": "USD", "value": "100.00"}}
Expand Down
9 changes: 5 additions & 4 deletions tests/test_orders.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json

import pytest
from responses import matchers

from mollie.api.error import EmbedNotFound
from mollie.api.objects.order import Order
Expand Down Expand Up @@ -84,9 +85,9 @@ def test_get_order(client, response):
def test_get_order_with_payments(client, response):
response.add(
response.GET,
f"https://api.mollie.com/v2/orders/{ORDER_ID}?embed=payments",
f"https://api.mollie.com/v2/orders/{ORDER_ID}",
body=response._get_body("order_single_with_embeds"),
match_querystring=True,
match=[matchers.query_param_matcher({"embed": "payments"})],
)

order = client.orders.get(ORDER_ID, embed="payments")
Expand All @@ -105,9 +106,9 @@ def test_get_order_with_payments_embed_error(client, response):
def test_get_order_with_payments_empty_embed(client, response):
response.add(
response.GET,
f"https://api.mollie.com/v2/orders/{ORDER_ID}?embed=payments",
f"https://api.mollie.com/v2/orders/{ORDER_ID}",
body=response._get_body("order_single"),
match_querystring=True,
match=[matchers.query_param_matcher({"embed": "payments"})],
)

order = client.orders.get(ORDER_ID, embed="payments")
Expand Down

0 comments on commit 58776c4

Please sign in to comment.