Skip to content

Commit 9073828

Browse files
BladieblahTom Hendrikx
authored andcommitted
Fix tests
1 parent 2e86b30 commit 9073828

File tree

6 files changed

+18
-16
lines changed

6 files changed

+18
-16
lines changed

mollie/api/objects/balance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from .balance_report import BalanceReport
44
from .base import ObjectBase
5-
from .list import ObjectList
5+
from .list import PaginationList
66

77

88
class Balance(ObjectBase):
@@ -59,7 +59,7 @@ def get_report(self, **params: Any) -> BalanceReport:
5959

6060
return BalanceReports(self.client, self).get_report(params=params)
6161

62-
def get_transactions(self, **params: Any) -> ObjectList:
62+
def get_transactions(self, **params: Any) -> PaginationList:
6363
from ..resources import BalanceTransactions
6464

6565
return BalanceTransactions(self.client, self).list(params=params)

mollie/api/objects/list.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from abc import ABC, abstractmethod
2-
from typing import TYPE_CHECKING, Type
2+
from typing import TYPE_CHECKING, Any, Optional, Type
3+
34
from .base import ObjectBase
45

56
if TYPE_CHECKING:
7+
from mollie.api.client import Client
68
from mollie.api.resources.base import ResourceBase
79

810

@@ -87,11 +89,10 @@ def new(self, result):
8789
...
8890

8991

90-
9192
class PaginationList(ListBase):
9293
_parent: "ResourceBase"
9394

94-
def __init__(self, result, parent: "ResourceBase", client=None):
95+
def __init__(self, result: Any, parent: "ResourceBase", client: "Client"):
9596
# If an empty dataset was injected, we mock the structure that the remainder of the clas expects.
9697
# TODO: it would be better if the ObjectList was initiated with a list of results, rather than with
9798
# the full datastructure as it is now, so we can remove all this mucking around with fake data,
@@ -130,7 +131,7 @@ def new(self, result):
130131
class ObjectList(ListBase):
131132
_object_type: Type[ObjectBase]
132133

133-
def __init__(self, result, object_type: Type[ObjectBase], client=None):
134+
def __init__(self, result: Any, object_type: Type[ObjectBase], client: Optional["Client"] = None):
134135
# If an empty dataset was injected, we mock the structure that the remainder of the clas expects.
135136
# TODO: it would be better if the ObjectList was initiated with a list of results, rather than with
136137
# the full datastructure as it is now, so we can remove all this mucking around with fake data,
@@ -148,10 +149,10 @@ def get_next(self):
148149

149150
def get_previous(self):
150151
return None
151-
152+
152153
@property
153154
def object_type(self):
154155
return self._object_type
155-
156+
156157
def new(self, result):
157158
return ObjectList(result, self._object_type, self.client)

mollie/api/resources/chargebacks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import TYPE_CHECKING, Any
22

33
from ..objects.chargeback import Chargeback
4-
from ..objects.list import ObjectList
4+
from ..objects.list import PaginationList
55
from .base import ResourceBase, ResourceGetMixin, ResourceListMixin
66

77
if TYPE_CHECKING:
@@ -72,7 +72,7 @@ def __init__(self, client: "Client", profile: "Profile") -> None:
7272
self._profile = profile
7373
super().__init__(client)
7474

75-
def list(self, **params: Any) -> ObjectList:
75+
def list(self, **params: Any) -> PaginationList:
7676
# Set the profileId in the query params
7777
params.update({"profileId": self._profile.id})
7878
return Chargebacks(self.client).list(**params)

mollie/api/resources/onboarding.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
class Onboarding(ResourceGetMixin):
1414
"""Resource handler for the `/onboarding` endpoint."""
15+
1516
object_type = OnboardingObject
1617

1718
def get(self, resource_id: str, **params: Any) -> OnboardingObject:

mollie/api/resources/payments.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import TYPE_CHECKING, Any, Dict, Optional
22

33
from ..objects.customer import Customer
4-
from ..objects.list import ObjectList
4+
from ..objects.list import PaginationList
55
from ..objects.order import Order
66
from ..objects.payment import Payment
77
from ..objects.profile import Profile
@@ -72,7 +72,7 @@ def __init__(self, client: "Client", order: Order) -> None:
7272
def get_resource_path(self) -> str:
7373
return f"orders/{self._order.id}/payments"
7474

75-
def list(self) -> ObjectList:
75+
def list(self) -> PaginationList:
7676
"""
7777
List the payments that might have been embedded in the related order.
7878
@@ -86,7 +86,7 @@ def list(self) -> ObjectList:
8686
},
8787
"count": len(payments),
8888
}
89-
return ObjectList(data, Payment, self.client)
89+
return PaginationList(data, self, self.client)
9090

9191

9292
class CustomerPayments(PaymentsBase, ResourceCreateMixin, ResourceListMixin):
@@ -143,7 +143,7 @@ def __init__(self, client: "Client", profile: Profile) -> None:
143143
self._profile = profile
144144
super().__init__(client)
145145

146-
def list(self, **params: Any) -> ObjectList:
146+
def list(self, **params: Any) -> PaginationList:
147147
# Set the profileId in the query params
148148
params.update({"profileId": self._profile.id})
149149
return Payments(self.client).list(**params)

mollie/api/resources/refunds.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import TYPE_CHECKING, Any, Dict, Optional
22

3-
from ..objects.list import ObjectList
3+
from ..objects.list import PaginationList
44
from ..objects.order import Order
55
from ..objects.payment import Payment
66
from ..objects.profile import Profile
@@ -97,7 +97,7 @@ def __init__(self, client: "Client", profile: Profile) -> None:
9797
self._profile = profile
9898
super().__init__(client)
9999

100-
def list(self, **params: Any) -> ObjectList:
100+
def list(self, **params: Any) -> PaginationList:
101101
# Set the profileId in the query params
102102
params.update({"profileId": self._profile.id})
103103
return Refunds(self.client).list(**params)

0 commit comments

Comments
 (0)