Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ extend-safe-fixes = [
"D415", # docstrings should end with a period, question mark, or exclamation point
]
ignore = [
"D200",
"D203", # no blank line before class
"D205",
"D212", # multi-line summary first line
Expand Down
4 changes: 1 addition & 3 deletions src/multisafepay/api/paths/auth/auth_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@


class AuthManager(AbstractManager):
"""
A manager class for handling authentication-related operations.
"""
"""A manager class for handling authentication-related operations."""

def __init__(self: "AuthManager", client: Client) -> None:
"""
Expand Down
4 changes: 1 addition & 3 deletions src/multisafepay/api/paths/capture/capture_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@


class CaptureManager(AbstractManager):
"""
A class to manage capture operations.
"""
"""A class to manage capture operations."""

def __init__(self: "CaptureManager", client: Client) -> None:
"""
Expand Down
4 changes: 1 addition & 3 deletions src/multisafepay/api/paths/categories/category_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@


class CategoryManager(AbstractManager):
"""
A manager class for handling category-related API requests.
"""
"""A manager class for handling category-related API requests."""

def __init__(self: "CategoryManager", client: Client) -> None:
"""
Expand Down
4 changes: 1 addition & 3 deletions src/multisafepay/api/paths/gateways/gateway_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@


class GatewayManager(AbstractManager):
"""
Manages gateway-related operations.
"""
"""Manages gateway-related operations."""

def __init__(self: "GatewayManager", client: Client) -> None:
"""
Expand Down
4 changes: 1 addition & 3 deletions src/multisafepay/api/paths/issuers/issuer_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@


class IssuerManager(AbstractManager):
"""
Manager class for handling issuer-related operations.
"""
"""Manager class for handling issuer-related operations."""

def __init__(self: "IssuerManager", client: Client) -> None:
"""
Expand Down
4 changes: 1 addition & 3 deletions src/multisafepay/api/paths/me/me_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@


class MeManager(AbstractManager):
"""
A manager class for handling 'me' related API requests.
"""
"""A manager class for handling 'me' related API requests."""

def __init__(self: "MeManager", client: Client) -> None:
"""
Expand Down
4 changes: 1 addition & 3 deletions src/multisafepay/api/paths/orders/order_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@


class OrderManager(AbstractManager):
"""
Manages operations related to orders, such as creating, updating, capturing, and refunding orders.
"""
"""Manages operations related to orders, such as creating, updating, capturing, and refunding orders."""

def __init__(self: "OrderManager", client: Client) -> None:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@


class PaymentMethodManager(AbstractManager):
"""
A class representing the PaymentMethodManager.
"""
"""A class representing the PaymentMethodManager."""

def __init__(self: "PaymentMethodManager", client: Client) -> None:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@


class TransactionManager(AbstractManager):
"""
A class representing the TransactionManager.
"""
"""A class representing the TransactionManager."""

def __init__(self: "TransactionManager", client: Client) -> None:
"""
Expand Down
5 changes: 1 addition & 4 deletions src/multisafepay/util/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@


class Webhook:
"""
A class to represent a webhook.

"""
"""A class to represent a webhook."""

@staticmethod
def validate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,12 @@ class MockItem:
"""Mock item for testing purposes."""

def __init__(self: "MockItem", value: object) -> None:
"""
Initialize a MockItem with a given value.

"""
"""Initialize a MockItem with a given value."""
self.value = value


def test_initialization_with_valid_data_and_pager():
"""
Test the initialization of a ListingPager object with valid data and a Pager.

"""
"""Test the initialization of a ListingPager object with valid data and a Pager."""
data = [{"value": 1}, {"value": 2}]
pager = Pager(
after="a1",
Expand All @@ -48,10 +42,7 @@ def test_initialization_with_valid_data_and_pager():


def test_initialization_with_empty_data_and_pager():
"""
Test the initialization of a ListingPager object with empty data and a Pager.

"""
"""Test the initialization of a ListingPager object with empty data and a Pager."""
data = []
pager = Pager(
after="a1",
Expand All @@ -69,10 +60,7 @@ def test_initialization_with_empty_data_and_pager():


def test_initialization_with_none_data_and_pager():
"""
Test the initialization of a ListingPager object with None data and a Pager.

"""
"""Test the initialization of a ListingPager object with None data and a Pager."""
data = None
pager = Pager(
after="a1",
Expand All @@ -90,10 +78,7 @@ def test_initialization_with_none_data_and_pager():


def test_listing_pager_with_no_cursor():
"""
Test the initialization of a ListingPager object with valid data and a Pager with no Cursor.

"""
"""Test the initialization of a ListingPager object with valid data and a Pager with no Cursor."""
data = [{"value": 1}, {"value": 2}]
pager = Pager(after="a1", before="b1", limit=10, cursor=None)
listing_pager = ListingPager(data=data, pager=pager, class_type=MockItem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@


def test_initialization_with_valid_data():
"""
Test the initialization of a Pager object with valid data.

"""
"""Test the initialization of a Pager object with valid data."""
cursor = Cursor(after="c1", before="c2")
pager = Pager(after="asd", before="dsa", cursor=cursor)
assert pager.after == "asd"
Expand All @@ -26,10 +23,7 @@ def test_initialization_with_valid_data():


def test_cursor_initialization_with_valid_data():
"""
Test the initialization of a Cursor object from a dictionary with valid data.

"""
"""Test the initialization of a Cursor object from a dictionary with valid data."""
data = {
"after": "a1",
"before": "b1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ def test_initializes_with_valid_values():


def test_creates_from_dict_with_name_and_rules():
"""
Test that a TaxRule instance is created from a dictionary with name and rules.

"""
"""Test that a TaxRule instance is created from a dictionary with name and rules."""
data = {"name": "Standard Tax", "rules": [{"rate": 21, "country": "NL"}]}
tax_rule = TaxRule.from_dict(data)
assert tax_rule.name == "Standard Tax"
Expand All @@ -45,10 +42,7 @@ def test_creates_from_dict_with_name_and_rules():


def test_creates_from_dict_with_only_rules():
"""
Test that a TaxRule instance is created from a dictionary with only rules.

"""
"""Test that a TaxRule instance is created from a dictionary with only rules."""
data = {"rules": [{"rate": 21, "country": "NL"}]}
tax_rule = TaxRule.from_dict(data)
assert tax_rule.name is None
Expand All @@ -58,10 +52,7 @@ def test_creates_from_dict_with_only_rules():


def test_adds_rules():
"""
Test that rules are added to a TaxRule instance.

"""
"""Test that rules are added to a TaxRule instance."""
tax_rule = TaxRule()
tax_rates = [TaxRate(rate=21, country="NL")]
tax_rule.add_rules(tax_rates)
Expand All @@ -71,10 +62,7 @@ def test_adds_rules():


def test_adds_a_single_rule():
"""
Test that a single rule is added to a TaxRule instance.

"""
"""Test that a single rule is added to a TaxRule instance."""
tax_rule = TaxRule()
tax_rate = TaxRate(rate=21, country="NL")
tax_rule.add_rule(tax_rate)
Expand Down
26 changes: 6 additions & 20 deletions tests/multisafepay/unit/api/base/listings/test_unit_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,58 +13,44 @@


def test_initialization_with_valid_data():
"""
Test the initialization of a Cursor object with valid data.

"""
"""Test the initialization of a Cursor object with valid data."""
cursor = Cursor(after="123", before="456")
assert cursor.after == "123"
assert cursor.before == "456"


def test_initialization_with_none_data():
"""
Test the initialization of a Cursor object with None data.
"""
"""Test the initialization of a Cursor object with None data."""
cursor = Cursor()
assert cursor.after is None
assert cursor.before is None


def test_from_dict_with_valid_data():
"""
Test the creation of a Cursor object from a dictionary with valid data.
"""
"""Test the creation of a Cursor object from a dictionary with valid data."""
data = {"after": "123", "before": "456"}
cursor = Cursor.from_dict(data)
assert cursor.after == "123"
assert cursor.before == "456"


def test_from_dict_with_none_data():
"""
Test the creation of a Cursor object from a dictionary with None data.

"""
"""Test the creation of a Cursor object from a dictionary with None data."""
data = {"after": None, "before": None}
cursor = Cursor.from_dict(data)
assert cursor.after is None
assert cursor.before is None


def test_from_dict_with_missing_keys():
"""
Test the creation of a Cursor object from a dictionary with missing keys.
"""
"""Test the creation of a Cursor object from a dictionary with missing keys."""
data = {}
cursor = Cursor.from_dict(data)
assert cursor.after is None
assert cursor.before is None


def test_from_dict_with_none_object():
"""
Test the creation of a Cursor object from a None object.
"""
"""Test the creation of a Cursor object from a None object."""
cursor = Cursor.from_dict(None)
assert cursor is None
30 changes: 6 additions & 24 deletions tests/multisafepay/unit/api/base/listings/test_unit_listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ def __init__(self: "MockItem", value: object) -> None:


def test_initialization_with_valid_data():
"""
Test the initialization of a Listing object with valid data.

"""
"""Test the initialization of a Listing object with valid data."""
data = [{"value": 1}, {"value": 2}]
listing = Listing(data=data, class_type=MockItem)
assert len(listing) == 2
Expand All @@ -32,30 +29,21 @@ def test_initialization_with_valid_data():


def test_initialization_with_empty_data():
"""
Test the initialization of a Listing object with empty data.

"""
"""Test the initialization of a Listing object with empty data."""
data = []
listing = Listing(data=data, class_type=MockItem)
assert len(listing) == 0


def test_initialization_with_none_data():
"""
Test the initialization of a Listing object with None data.

"""
"""Test the initialization of a Listing object with None data."""
data = None
listing = Listing(data=data, class_type=MockItem)
assert len(listing) == 0


def test_initialization_with_mixed_data():
"""
Test the initialization of a Listing object with mixed data (valid and None).

"""
"""Test the initialization of a Listing object with mixed data (valid and None)."""
data = [{"value": 1}, None, {"value": 2}]
listing = Listing(data=data, class_type=MockItem)
assert len(listing) == 2
Expand All @@ -64,10 +52,7 @@ def test_initialization_with_mixed_data():


def test_get_data_returns_correct_list():
"""
Test the get_data method of a Listing object.

"""
"""Test the get_data method of a Listing object."""
data = [{"value": 1}, {"value": 2}]
listing = Listing(data=data, class_type=MockItem)
data_list = listing.get_data()
Expand All @@ -77,10 +62,7 @@ def test_get_data_returns_correct_list():


def test_append_adds_item_to_list():
"""
Test the append method of a Listing object.

"""
"""Test the append method of a Listing object."""
data = [{"value": 1}]
listing = Listing(data=data, class_type=MockItem)
new_item = MockItem(value=2)
Expand Down
Loading