diff --git a/pyproject.toml b/pyproject.toml index 2c796b9..db9ee05 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 diff --git a/src/multisafepay/api/paths/auth/auth_manager.py b/src/multisafepay/api/paths/auth/auth_manager.py index 13f8f1b..07dc8e4 100644 --- a/src/multisafepay/api/paths/auth/auth_manager.py +++ b/src/multisafepay/api/paths/auth/auth_manager.py @@ -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: """ diff --git a/src/multisafepay/api/paths/capture/capture_manager.py b/src/multisafepay/api/paths/capture/capture_manager.py index 681d283..0c91780 100644 --- a/src/multisafepay/api/paths/capture/capture_manager.py +++ b/src/multisafepay/api/paths/capture/capture_manager.py @@ -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: """ diff --git a/src/multisafepay/api/paths/categories/category_manager.py b/src/multisafepay/api/paths/categories/category_manager.py index c1156d1..e11aa77 100644 --- a/src/multisafepay/api/paths/categories/category_manager.py +++ b/src/multisafepay/api/paths/categories/category_manager.py @@ -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: """ diff --git a/src/multisafepay/api/paths/gateways/gateway_manager.py b/src/multisafepay/api/paths/gateways/gateway_manager.py index 7ec556f..b759da1 100644 --- a/src/multisafepay/api/paths/gateways/gateway_manager.py +++ b/src/multisafepay/api/paths/gateways/gateway_manager.py @@ -26,9 +26,7 @@ class GatewayManager(AbstractManager): - """ - Manages gateway-related operations. - """ + """Manages gateway-related operations.""" def __init__(self: "GatewayManager", client: Client) -> None: """ diff --git a/src/multisafepay/api/paths/issuers/issuer_manager.py b/src/multisafepay/api/paths/issuers/issuer_manager.py index 331b1c2..6e54858 100644 --- a/src/multisafepay/api/paths/issuers/issuer_manager.py +++ b/src/multisafepay/api/paths/issuers/issuer_manager.py @@ -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: """ diff --git a/src/multisafepay/api/paths/me/me_manager.py b/src/multisafepay/api/paths/me/me_manager.py index 360188a..5b4b3ae 100644 --- a/src/multisafepay/api/paths/me/me_manager.py +++ b/src/multisafepay/api/paths/me/me_manager.py @@ -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: """ diff --git a/src/multisafepay/api/paths/orders/order_manager.py b/src/multisafepay/api/paths/orders/order_manager.py index 1a73c74..38066b4 100644 --- a/src/multisafepay/api/paths/orders/order_manager.py +++ b/src/multisafepay/api/paths/orders/order_manager.py @@ -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: """ diff --git a/src/multisafepay/api/paths/payment_methods/payment_method_manager.py b/src/multisafepay/api/paths/payment_methods/payment_method_manager.py index 46a9a1b..aeb6bf5 100644 --- a/src/multisafepay/api/paths/payment_methods/payment_method_manager.py +++ b/src/multisafepay/api/paths/payment_methods/payment_method_manager.py @@ -28,9 +28,7 @@ class PaymentMethodManager(AbstractManager): - """ - A class representing the PaymentMethodManager. - """ + """A class representing the PaymentMethodManager.""" def __init__(self: "PaymentMethodManager", client: Client) -> None: """ diff --git a/src/multisafepay/api/paths/transactions/transaction_manager.py b/src/multisafepay/api/paths/transactions/transaction_manager.py index 8a036af..ae41ba7 100644 --- a/src/multisafepay/api/paths/transactions/transaction_manager.py +++ b/src/multisafepay/api/paths/transactions/transaction_manager.py @@ -39,9 +39,7 @@ class TransactionManager(AbstractManager): - """ - A class representing the TransactionManager. - """ + """A class representing the TransactionManager.""" def __init__(self: "TransactionManager", client: Client) -> None: """ diff --git a/src/multisafepay/util/webhook.py b/src/multisafepay/util/webhook.py index dcc893e..333d631 100644 --- a/src/multisafepay/util/webhook.py +++ b/src/multisafepay/util/webhook.py @@ -17,10 +17,7 @@ class Webhook: - """ - A class to represent a webhook. - - """ + """A class to represent a webhook.""" @staticmethod def validate( diff --git a/tests/multisafepay/integration/api/base/listings/test_integration_listing_pager.py b/tests/multisafepay/integration/api/base/listings/test_integration_listing_pager.py index 0967476..429015c 100644 --- a/tests/multisafepay/integration/api/base/listings/test_integration_listing_pager.py +++ b/tests/multisafepay/integration/api/base/listings/test_integration_listing_pager.py @@ -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", @@ -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", @@ -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", @@ -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) diff --git a/tests/multisafepay/integration/api/base/listings/test_integration_pager.py b/tests/multisafepay/integration/api/base/listings/test_integration_pager.py index aba0140..6ad7731 100644 --- a/tests/multisafepay/integration/api/base/listings/test_integration_pager.py +++ b/tests/multisafepay/integration/api/base/listings/test_integration_pager.py @@ -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" @@ -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", diff --git a/tests/multisafepay/integration/api/shared/checkout/test_integration_tax_rule.py b/tests/multisafepay/integration/api/shared/checkout/test_integration_tax_rule.py index b2f27ff..4b81d80 100644 --- a/tests/multisafepay/integration/api/shared/checkout/test_integration_tax_rule.py +++ b/tests/multisafepay/integration/api/shared/checkout/test_integration_tax_rule.py @@ -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" @@ -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 @@ -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) @@ -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) diff --git a/tests/multisafepay/unit/api/base/listings/test_unit_cursor.py b/tests/multisafepay/unit/api/base/listings/test_unit_cursor.py index 1e0bb83..1977e36 100644 --- a/tests/multisafepay/unit/api/base/listings/test_unit_cursor.py +++ b/tests/multisafepay/unit/api/base/listings/test_unit_cursor.py @@ -13,28 +13,21 @@ 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" @@ -42,10 +35,7 @@ def test_from_dict_with_valid_data(): 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 @@ -53,9 +43,7 @@ def test_from_dict_with_none_data(): 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 @@ -63,8 +51,6 @@ def test_from_dict_with_missing_keys(): 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 diff --git a/tests/multisafepay/unit/api/base/listings/test_unit_listing.py b/tests/multisafepay/unit/api/base/listings/test_unit_listing.py index d5edf22..cb4227b 100644 --- a/tests/multisafepay/unit/api/base/listings/test_unit_listing.py +++ b/tests/multisafepay/unit/api/base/listings/test_unit_listing.py @@ -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 @@ -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 @@ -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() @@ -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) diff --git a/tests/multisafepay/unit/api/base/listings/test_unit_listing_pager.py b/tests/multisafepay/unit/api/base/listings/test_unit_listing_pager.py index 588f454..7eae5d1 100644 --- a/tests/multisafepay/unit/api/base/listings/test_unit_listing_pager.py +++ b/tests/multisafepay/unit/api/base/listings/test_unit_listing_pager.py @@ -15,18 +15,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_listing_pager_with_not_pager(): - """ - Test the initialization of a ListingPager object with valid data and no Pager. - - """ + """Test the initialization of a ListingPager object with valid data and no Pager.""" data = [{"value": 1}, {"value": 2}] listing_pager = ListingPager(data=data, pager=None, class_type=MockItem) assert len(listing_pager) == 2 diff --git a/tests/multisafepay/unit/api/base/listings/test_unit_pager.py b/tests/multisafepay/unit/api/base/listings/test_unit_pager.py index d1eec80..b80d46c 100644 --- a/tests/multisafepay/unit/api/base/listings/test_unit_pager.py +++ b/tests/multisafepay/unit/api/base/listings/test_unit_pager.py @@ -12,10 +12,7 @@ def test_initialization_with_empty_data(): - """ - Test the initialization of a Pager object with empty data. - - """ + """Test the initialization of a Pager object with empty data.""" pager = Pager() assert pager.after is None assert pager.before is None @@ -23,10 +20,7 @@ def test_initialization_with_empty_data(): def test_initialization_with_none_cursor(): - """ - Test the initialization of a Pager object with None cursor. - - """ + """Test the initialization of a Pager object with None cursor.""" pager = Pager(after="asd", before="dsa", cursor=None) assert pager.after == "asd" assert pager.before == "dsa" @@ -34,20 +28,14 @@ def test_initialization_with_none_cursor(): def test_initialization_with_none_data(): - """ - Test the initialization of a Pager object from None data. - - """ + """Test the initialization of a Pager object from None data.""" data = None pager = Pager.from_dict(data) assert pager is None 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", diff --git a/tests/multisafepay/unit/api/base/test_unit_decorator.py b/tests/multisafepay/unit/api/base/test_unit_decorator.py index 0f5f0cb..5065739 100644 --- a/tests/multisafepay/unit/api/base/test_unit_decorator.py +++ b/tests/multisafepay/unit/api/base/test_unit_decorator.py @@ -12,8 +12,6 @@ def test_initialization_with_empty_dependencies(): - """ - Test the initialization of a Decorator object with empty dependencies. - """ + """Test the initialization of a Decorator object with empty dependencies.""" decorator = Decorator() assert decorator.get_dependencies() == {} diff --git a/tests/multisafepay/unit/api/path/orders/order_id/capture/request/test_unit_order_capture_request.py b/tests/multisafepay/unit/api/path/orders/order_id/capture/request/test_unit_order_capture_request.py index 3b6a29e..f4a3493 100644 --- a/tests/multisafepay/unit/api/path/orders/order_id/capture/request/test_unit_order_capture_request.py +++ b/tests/multisafepay/unit/api/path/orders/order_id/capture/request/test_unit_order_capture_request.py @@ -14,9 +14,7 @@ def test_initializes_capture_order_request_with_default_values(): - """ - Test that a CaptureOrderRequest object is correctly initialized with default values. - """ + """Test that a CaptureOrderRequest object is correctly initialized with default values.""" request = CaptureOrderRequest( amount=1000, new_order_id="ORD123", @@ -39,9 +37,7 @@ def test_initializes_capture_order_request_with_default_values(): def test_initializes_capture_order_request_with_empty_values(): - """ - Test that a CaptureOrderRequest object is correctly initialized with empty values. - """ + """Test that a CaptureOrderRequest object is correctly initialized with empty values.""" request = CaptureOrderRequest() assert request.amount is None @@ -55,9 +51,7 @@ def test_initializes_capture_order_request_with_empty_values(): def test_add_amount_updates_value(): - """ - Test that the add_amount method updates the amount attribute to the given value. - """ + """Test that the add_amount method updates the amount attribute to the given value.""" request = CaptureOrderRequest() request_updated = request.add_amount(500) @@ -66,9 +60,7 @@ def test_add_amount_updates_value(): def test_add_new_order_id_updates_value(): - """ - Test that the add_new_order_id method updates the new_order_id attribute to the given value. - """ + """Test that the add_new_order_id method updates the new_order_id attribute to the given value.""" request = CaptureOrderRequest() request_updated = request.add_new_order_id("order123") @@ -89,9 +81,7 @@ def test_add_new_order_status_updates_value(): def test_add_invoice_id_updates_value(): - """ - Test that the add_invoice_id method updates the invoice_id attribute to the given value. - """ + """Test that the add_invoice_id method updates the invoice_id attribute to the given value.""" request = CaptureOrderRequest() request_updated = request.add_invoice_id("invoice123") @@ -100,9 +90,7 @@ def test_add_invoice_id_updates_value(): def test_add_carrier_updates_value(): - """ - Test that the add_carrier method updates the carrier attribute to the given value. - """ + """Test that the add_carrier method updates the carrier attribute to the given value.""" request = CaptureOrderRequest() request_updated = request.add_carrier("DHL") @@ -111,9 +99,7 @@ def test_add_carrier_updates_value(): def test_add_reason_updates_value(): - """ - Test that the add_reason method updates the reason attribute to the given value. - """ + """Test that the add_reason method updates the reason attribute to the given value.""" request = CaptureOrderRequest() request_updated = request.add_reason("Customer request") @@ -122,9 +108,7 @@ def test_add_reason_updates_value(): def test_add_tracktrace_code_updates_value(): - """ - Test that the add_tracktrace_code method updates the tracktrace_code attribute to the given value. - """ + """Test that the add_tracktrace_code method updates the tracktrace_code attribute to the given value.""" request = CaptureOrderRequest() request_updated = request.add_tracktrace_code("TRACK123") @@ -133,9 +117,7 @@ def test_add_tracktrace_code_updates_value(): def test_description_updates_value(): - """ - Test that the add_description method updates the description attribute to the given value. - """ + """Test that the add_description method updates the description attribute to the given value.""" request = CaptureOrderRequest() request_updated = request.add_description("This is a test description.") diff --git a/tests/multisafepay/unit/api/path/orders/order_id/capture/response/test_unit_order_capture.py b/tests/multisafepay/unit/api/path/orders/order_id/capture/response/test_unit_order_capture.py index f35c3c1..ed3439c 100644 --- a/tests/multisafepay/unit/api/path/orders/order_id/capture/response/test_unit_order_capture.py +++ b/tests/multisafepay/unit/api/path/orders/order_id/capture/response/test_unit_order_capture.py @@ -14,9 +14,7 @@ def test_initializes_order_capture_correctly(): - """ - Test that an OrderCapture object is correctly initialized with given data. - """ + """Test that an OrderCapture object is correctly initialized with given data.""" order_capture = OrderCapture( transaction_id="TX123", order_id="ORD123", @@ -28,9 +26,7 @@ def test_initializes_order_capture_correctly(): def test_initializes_order_capture_with_empty_values(): - """ - Test that an OrderCapture object is correctly initialized with default values. - """ + """Test that an OrderCapture object is correctly initialized with default values.""" order_capture = OrderCapture() assert order_capture.transaction_id is None assert order_capture.order_id is None @@ -38,9 +34,7 @@ def test_initializes_order_capture_with_empty_values(): def test_from_dict_initializes_order_capture_correctly(): - """ - Test that an OrderCapture object is correctly initialized from a dictionary. - """ + """Test that an OrderCapture object is correctly initialized from a dictionary.""" data = { "transaction_id": "TX123", "order_id": "ORD123", @@ -53,9 +47,7 @@ def test_from_dict_initializes_order_capture_correctly(): def test_from_dict_initializes_order_capture_with_empty_dict(): - """ - Test that an OrderCapture object is correctly initialized from an empty dictionary. - """ + """Test that an OrderCapture object is correctly initialized from an empty dictionary.""" data = {} order_capture = OrderCapture.from_dict(data) assert order_capture.transaction_id is None @@ -64,8 +56,6 @@ def test_from_dict_initializes_order_capture_with_empty_dict(): def test_from_dict_returns_none_for_none_input(): - """ - Test that the from_dict method returns None when given None as input. - """ + """Test that the from_dict method returns None when given None as input.""" order_capture = OrderCapture.from_dict(None) assert order_capture is None diff --git a/tests/multisafepay/unit/api/path/orders/order_id/refund/request/test_unit_refund_request.py b/tests/multisafepay/unit/api/path/orders/order_id/refund/request/test_unit_refund_request.py index d78adb4..d950689 100644 --- a/tests/multisafepay/unit/api/path/orders/order_id/refund/request/test_unit_refund_request.py +++ b/tests/multisafepay/unit/api/path/orders/order_id/refund/request/test_unit_refund_request.py @@ -14,9 +14,7 @@ def test_initializes_refund_order_request_correctly(): - """ - Test that a RefundOrderRequest object is correctly initialized with given data. - """ + """Test that a RefundOrderRequest object is correctly initialized with given data.""" request = RefundOrderRequest() request.add_currency("USD") request.add_amount(1000) @@ -28,9 +26,7 @@ def test_initializes_refund_order_request_correctly(): def test_initializes_refund_order_request_with_default_values(): - """ - Test that a RefundOrderRequest object is correctly initialized with default values. - """ + """Test that a RefundOrderRequest object is correctly initialized with default values.""" request = RefundOrderRequest() assert request.currency is None @@ -40,9 +36,7 @@ def test_initializes_refund_order_request_with_default_values(): def add_currency_updates_value(): - """ - Test that the add_currency method updates the currency attribute to the given value. - """ + """Test that the add_currency method updates the currency attribute to the given value.""" request = RefundOrderRequest() request_updated = request.add_currency("EUR") @@ -51,9 +45,7 @@ def add_currency_updates_value(): def add_amount_updates_value(): - """ - Test that the add_amount method updates the amount attribute to the given value. - """ + """Test that the add_amount method updates the amount attribute to the given value.""" request = RefundOrderRequest() request_updated = request.add_amount(500) @@ -62,9 +54,7 @@ def add_amount_updates_value(): def add_description_updates_value(): - """ - Test that the add_description method updates the description attribute to the given value. - """ + """Test that the add_description method updates the description attribute to the given value.""" request = RefundOrderRequest() request_updated = request.add_description("Partial refund") diff --git a/tests/multisafepay/unit/api/path/orders/order_id/refund/response/test_unit_order_refund.py b/tests/multisafepay/unit/api/path/orders/order_id/refund/response/test_unit_order_refund.py index 2b0d74b..ebbcfe3 100644 --- a/tests/multisafepay/unit/api/path/orders/order_id/refund/response/test_unit_order_refund.py +++ b/tests/multisafepay/unit/api/path/orders/order_id/refund/response/test_unit_order_refund.py @@ -14,9 +14,7 @@ def test_initializes_order_refund_correctly(): - """ - Test that an OrderRefund object is correctly initialized with given values. - """ + """Test that an OrderRefund object is correctly initialized with given values.""" order_refund = OrderRefund( transaction_id="12345", refund_id="54321", @@ -29,9 +27,7 @@ def test_initializes_order_refund_correctly(): def test_initializes_order_refund_with_empty_values(): - """ - Test that an OrderRefund object is correctly initialized with empty values. - """ + """Test that an OrderRefund object is correctly initialized with empty values.""" order_refund = OrderRefund() assert order_refund.transaction_id is None @@ -40,9 +36,7 @@ def test_initializes_order_refund_with_empty_values(): def test_from_dict_initializes_order_refund_correctly(): - """ - Test that an OrderRefund object is correctly initialized from a dictionary with given values. - """ + """Test that an OrderRefund object is correctly initialized from a dictionary with given values.""" data = { "transaction_id": "12345", "refund_id": "54321", @@ -56,9 +50,7 @@ def test_from_dict_initializes_order_refund_correctly(): def test_from_dict_initializes_order_refund_with_empty_dict(): - """ - Test that an OrderRefund object is correctly initialized from an empty dictionary. - """ + """Test that an OrderRefund object is correctly initialized from an empty dictionary.""" data = {} order_refund = OrderRefund.from_dict(data) @@ -68,9 +60,7 @@ def test_from_dict_initializes_order_refund_with_empty_dict(): def test_from_dict_returns_none_if_input_is_none(): - """ - Test that the from_dict method returns None if the input is None. - """ + """Test that the from_dict method returns None if the input is None.""" order_refund = OrderRefund.from_dict(None) assert order_refund is None diff --git a/tests/multisafepay/unit/api/path/orders/order_id/update/request/test_unit_update_request.py b/tests/multisafepay/unit/api/path/orders/order_id/update/request/test_unit_update_request.py index 4aac5a7..f0a121f 100644 --- a/tests/multisafepay/unit/api/path/orders/order_id/update/request/test_unit_update_request.py +++ b/tests/multisafepay/unit/api/path/orders/order_id/update/request/test_unit_update_request.py @@ -14,9 +14,7 @@ def test_initializes_update_order_request_correctly(): - """ - Test that an UpdateOrderRequest object is correctly initialized with given values. - """ + """Test that an UpdateOrderRequest object is correctly initialized with given values.""" request = UpdateOrderRequest( tracktrace_code="123ABC", tracktrace_url="http://example.com/track", @@ -45,9 +43,7 @@ def test_initializes_update_order_request_correctly(): def test_initializes_update_order_request_with_empty_values(): - """ - Test that an UpdateOrderRequest object is correctly initialized with empty values. - """ + """Test that an UpdateOrderRequest object is correctly initialized with empty values.""" request = UpdateOrderRequest() assert request.tracktrace_code is None @@ -64,9 +60,7 @@ def test_initializes_update_order_request_with_empty_values(): def test_add_tracktrace_code_updates_value(): - """ - Test that the add_tracktrace_code method updates the tracktrace_code attribute. - """ + """Test that the add_tracktrace_code method updates the tracktrace_code attribute.""" request = UpdateOrderRequest() request_updated = request.add_tracktrace_code("123ABC") @@ -75,9 +69,7 @@ def test_add_tracktrace_code_updates_value(): def test_add_tracktrace_url_updates_value(): - """ - Test that the add_tracktrace_url method updates the tracktrace_url attribute. - """ + """Test that the add_tracktrace_url method updates the tracktrace_url attribute.""" request = UpdateOrderRequest() request_updated = request.add_tracktrace_url("http://example.com/track") @@ -86,9 +78,7 @@ def test_add_tracktrace_url_updates_value(): def test_add_carrier_updates_value(): - """ - Test that the add_carrier method updates the carrier attribute. - """ + """Test that the add_carrier method updates the carrier attribute.""" request = UpdateOrderRequest() request_updated = request.add_carrier("CarrierName") @@ -97,9 +87,7 @@ def test_add_carrier_updates_value(): def test_add_ship_date_updates_value(): - """ - Test that the add_ship_date method updates the ship_date attribute. - """ + """Test that the add_ship_date method updates the ship_date attribute.""" request = UpdateOrderRequest() request_updated = request.add_ship_date("2023-10-01") @@ -108,9 +96,7 @@ def test_add_ship_date_updates_value(): def test_add_reason_updates_value(): - """ - Test that the add_reason method updates the reason attribute. - """ + """Test that the add_reason method updates the reason attribute.""" request = UpdateOrderRequest() request_updated = request.add_reason("Update reason") @@ -119,9 +105,7 @@ def test_add_reason_updates_value(): def test_add_invoice_id_updates_value(): - """ - Test that the add_invoice_id method updates the invoice_id attribute. - """ + """Test that the add_invoice_id method updates the invoice_id attribute.""" request = UpdateOrderRequest() request_updated = request.add_invoice_id("INV123") @@ -130,9 +114,7 @@ def test_add_invoice_id_updates_value(): def test_add_invoice_url_updates_value(): - """ - Test that the add_invoice_url method updates the invoice_url attribute. - """ + """Test that the add_invoice_url method updates the invoice_url attribute.""" request = UpdateOrderRequest() request_updated = request.add_invoice_url("http://example.com/invoice") @@ -141,9 +123,7 @@ def test_add_invoice_url_updates_value(): def test_add_po_number_updates_value(): - """ - Test that the add_po_number method updates the po_number attribute. - """ + """Test that the add_po_number method updates the po_number attribute.""" request = UpdateOrderRequest() request_updated = request.add_po_number("PO123") @@ -152,9 +132,7 @@ def test_add_po_number_updates_value(): def test_add_status_updates_value(): - """ - Test that the add_status method updates the status attribute. - """ + """Test that the add_status method updates the status attribute.""" request = UpdateOrderRequest() request_updated = request.add_status("Shipped") @@ -163,9 +141,7 @@ def test_add_status_updates_value(): def test_add_exclude_order_updates_value(): - """ - Test that the add_exclude_order method updates the exclude_order attribute. - """ + """Test that the add_exclude_order method updates the exclude_order attribute.""" request = UpdateOrderRequest() request_updated = request.add_exclude_order(True) @@ -174,9 +150,7 @@ def test_add_exclude_order_updates_value(): def test_add_extend_expiration_updates_value(): - """ - Test that the add_extend_expiration method updates the extend_expiration attribute. - """ + """Test that the add_extend_expiration method updates the extend_expiration attribute.""" request = UpdateOrderRequest() request_updated = request.add_extend_expiration(True) diff --git a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_account.py b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_account.py index cc0fb4d..9cc21e9 100644 --- a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_account.py +++ b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_account.py @@ -14,9 +14,7 @@ def test_initializes_account_correctly(): - """ - Test that an Account object is correctly initialized with given values. - """ + """Test that an Account object is correctly initialized with given values.""" account = Account( account_id="12345", account_holder_name="John Doe", @@ -31,9 +29,7 @@ def test_initializes_account_correctly(): def test_initializes_account_with_empty_values(): - """ - Test that an Account object is correctly initialized with empty values. - """ + """Test that an Account object is correctly initialized with empty values.""" account = Account() assert account.account_id is None @@ -43,9 +39,7 @@ def test_initializes_account_with_empty_values(): def test_add_account_id_updates_value(): - """ - Test that the add_account_id method updates the account_id attribute. - """ + """Test that the add_account_id method updates the account_id attribute.""" request = Account() request_updated = request.add_account_id("NL91ABNA0417164300") @@ -54,9 +48,7 @@ def test_add_account_id_updates_value(): def test_add_account_holder_name_updates_value(): - """ - Test that the add_account_holder_name method updates the account_holder_name attribute. - """ + """Test that the add_account_holder_name method updates the account_holder_name attribute.""" request = Account() request_updated = request.add_account_holder_name("John Doe") @@ -65,9 +57,7 @@ def test_add_account_holder_name_updates_value(): def test_add_account_holder_iban_updates_value(): - """ - Test that the add_account_holder_iban method updates the account_holder_iban attribute. - """ + """Test that the add_account_holder_iban method updates the account_holder_iban attribute.""" request = Account() request_updated = request.add_account_holder_iban("NL91ABNA0417164300") @@ -76,9 +66,7 @@ def test_add_account_holder_iban_updates_value(): def test_add_emandate_updates_value(): - """ - Test that the add_emandate method updates the emandate attribute. - """ + """Test that the add_emandate method updates the emandate attribute.""" request = Account() request_updated = request.add_emandate("EM123") diff --git a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_creditcard.py b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_creditcard.py index 0f65d47..bb7fd14 100644 --- a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_creditcard.py +++ b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_creditcard.py @@ -14,9 +14,7 @@ def test_initializes_creditcard_correctly(): - """ - Test that a Creditcard object is correctly initialized with given values. - """ + """Test that a Creditcard object is correctly initialized with given values.""" creditcard = Creditcard( card_number="4111111111111111", card_holder_name="John Doe", @@ -35,9 +33,7 @@ def test_initializes_creditcard_correctly(): def test_initializes_creditcard_with_empty_values(): - """ - Test that a Creditcard object is correctly initialized with empty values. - """ + """Test that a Creditcard object is correctly initialized with empty values.""" creditcard = Creditcard() assert creditcard.card_number is None @@ -49,9 +45,7 @@ def test_initializes_creditcard_with_empty_values(): def test_add_card_number_updates_value(): - """ - Test that the add_card_number method updates the card_number attribute. - """ + """Test that the add_card_number method updates the card_number attribute.""" request = Creditcard() request_updated = request.add_card_number("4111111111111111") @@ -60,9 +54,7 @@ def test_add_card_number_updates_value(): def test_add_card_holder_name_updates_value(): - """ - Test that the add_card_holder_name method updates the card_holder_name attribute. - """ + """Test that the add_card_holder_name method updates the card_holder_name attribute.""" request = Creditcard() request_updated = request.add_card_holder_name("John Doe") @@ -71,9 +63,7 @@ def test_add_card_holder_name_updates_value(): def test_add_card_expiry_date_updates_value(): - """ - Test that the add_card_expiry_date method updates the card_expiry_date attribute. - """ + """Test that the add_card_expiry_date method updates the card_expiry_date attribute.""" request = Creditcard() request_updated = request.add_card_expiry_date("12/25") @@ -82,9 +72,7 @@ def test_add_card_expiry_date_updates_value(): def test_add_cvc_updates_value(): - """ - Test that the add_cvc method updates the cvc attribute. - """ + """Test that the add_cvc method updates the cvc attribute.""" request = Creditcard() request_updated = request.add_cvc("123") @@ -93,9 +81,7 @@ def test_add_cvc_updates_value(): def test_add_flexible_3d_updates_value(): - """ - Test that the add_flexible_3d method updates the flexible_3d attribute. - """ + """Test that the add_flexible_3d method updates the flexible_3d attribute.""" request = Creditcard() request_updated = request.add_flexible_3d(True) @@ -104,9 +90,7 @@ def test_add_flexible_3d_updates_value(): def test_add_term_url_updates_value(): - """ - Test that the add_term_url method updates the term_url attribute. - """ + """Test that the add_term_url method updates the term_url attribute.""" request = Creditcard() request_updated = request.add_term_url("https://example.com/term") diff --git a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_destination_holder.py b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_destination_holder.py index d1cc9b9..f8b2fcc 100644 --- a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_destination_holder.py +++ b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_destination_holder.py @@ -14,9 +14,7 @@ def test_initializes_destination_holder_correctly(): - """ - Test that a DestinationHolder object is correctly initialized with given values. - """ + """Test that a DestinationHolder object is correctly initialized with given values.""" destination_holder = DestinationHolder( name="Jane Doe", city="Amsterdam", @@ -33,9 +31,7 @@ def test_initializes_destination_holder_correctly(): def test_initializes_destination_holder_with_empty_values(): - """ - Test that a DestinationHolder object is correctly initialized with empty values. - """ + """Test that a DestinationHolder object is correctly initialized with empty values.""" destination_holder = DestinationHolder() assert destination_holder.name is None @@ -46,9 +42,7 @@ def test_initializes_destination_holder_with_empty_values(): def test_add_name_updates_value(): - """ - Test that the add_name method updates the name attribute. - """ + """Test that the add_name method updates the name attribute.""" request = DestinationHolder() request_update = request.add_name("Jane Doe") @@ -57,9 +51,7 @@ def test_add_name_updates_value(): def test_add_city_updates_value(): - """ - Test that the add_city method updates the city attribute. - """ + """Test that the add_city method updates the city attribute.""" request = DestinationHolder() request_update = request.add_city("Amsterdam") @@ -68,9 +60,7 @@ def test_add_city_updates_value(): def test_add_country_updates_value(): - """ - Test that the add_country method updates the country attribute. - """ + """Test that the add_country method updates the country attribute.""" request = DestinationHolder() request_update = request.add_country("NL") @@ -79,9 +69,7 @@ def test_add_country_updates_value(): def test_add_iban_updates_value(): - """ - Test that the add_iban method updates the iban attribute. - """ + """Test that the add_iban method updates the iban attribute.""" request = DestinationHolder() request_update = request.add_iban("NL91ABNA0417164300") @@ -90,9 +78,7 @@ def test_add_iban_updates_value(): def test_add_swift_updates_value(): - """ - Test that the add_swift method updates the swift attribute. - """ + """Test that the add_swift method updates the swift attribute.""" request = DestinationHolder() request_update = request.add_swift("ABNANL2A") diff --git a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_meta.py b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_meta.py index b756da1..c487128 100644 --- a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_meta.py +++ b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_meta.py @@ -14,9 +14,7 @@ def test_initializes_meta_correctly(): - """ - Test that a Meta object is correctly initialized with given data. - """ + """Test that a Meta object is correctly initialized with given data.""" meta = Meta( birthday="1990-01-01", bank_account="NL91ABNA0417164300", @@ -33,9 +31,7 @@ def test_initializes_meta_correctly(): def test_initializes_meta_with_empty_values(): - """ - Test that a Meta object is correctly initialized with empty values. - """ + """Test that a Meta object is correctly initialized with empty values.""" meta = Meta() assert meta.birthday is None @@ -46,9 +42,7 @@ def test_initializes_meta_with_empty_values(): def test_add_birthday_updates_value(): - """ - Test that the add_birthday method updates the birthday attribute to the given value. - """ + """Test that the add_birthday method updates the birthday attribute to the given value.""" request = Meta() request_updated = request.add_birthday("1990-01-01") @@ -57,9 +51,7 @@ def test_add_birthday_updates_value(): def test_add_bank_account_updates_value(): - """ - Test that the add_bank_account method updates the bank_account attribute to the given value. - """ + """Test that the add_bank_account method updates the bank_account attribute to the given value.""" request = Meta() request_updated = request.add_bank_account("NL91ABNA0417164300") @@ -68,9 +60,7 @@ def test_add_bank_account_updates_value(): def test_add_phone_updates_value(): - """ - Test that the add_phone method updates the phone attribute to the given value. - """ + """Test that the add_phone method updates the phone attribute to the given value.""" request = Meta() request_updated = request.add_phone("+1234567890") @@ -79,9 +69,7 @@ def test_add_phone_updates_value(): def test_add_email_address_updates_value(): - """ - Test that the add_email_address method updates the email_address attribute to the given value. - """ + """Test that the add_email_address method updates the email_address attribute to the given value.""" request = Meta() request_updated = request.add_email_address("test@example.com") @@ -90,9 +78,7 @@ def test_add_email_address_updates_value(): def test_add_gender_updates_value(): - """ - Test that the add_gender method updates the gender attribute to the given value. - """ + """Test that the add_gender method updates the gender attribute to the given value.""" request = Meta() request_updated = request.add_gender("male") diff --git a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_order_issuer.py b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_order_issuer.py index f61b787..11d9c20 100644 --- a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_order_issuer.py +++ b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_order_issuer.py @@ -14,27 +14,21 @@ def test_initializes_issuer_correctly(): - """ - Test that the Issuer object is initialized correctly with given values. - """ + """Test that the Issuer object is initialized correctly with given values.""" issuer = Issuer(issuer_id="12345") assert issuer.issuer_id == "12345" def test_initializes_issuer_with_empty_values(): - """ - Test that the Issuer object is initialized correctly with empty values. - """ + """Test that the Issuer object is initialized correctly with empty values.""" issuer = Issuer() assert issuer.issuer_id is None def test_add_issuer_id_updates_value(): - """ - Test that the add_issuer_id method updates the issuer_id attribute. - """ + """Test that the add_issuer_id method updates the issuer_id attribute.""" request = Issuer() request_updated = request.add_issuer_id("12345") diff --git a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_qr_code.py b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_qr_code.py index 08f83d4..24b09ba 100644 --- a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_qr_code.py +++ b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_qr_code.py @@ -14,9 +14,7 @@ def test_initializes_qr_code_correctly(): - """ - Test that the QrCode object is initialized correctly with given values. - """ + """Test that the QrCode object is initialized correctly with given values.""" qr_code = QrCode( qr_size=200, allow_multiple=True, @@ -33,9 +31,7 @@ def test_initializes_qr_code_correctly(): def test_initializes_qr_code_with_empty_values(): - """ - Test that the QrCode object is initialized correctly with empty values. - """ + """Test that the QrCode object is initialized correctly with empty values.""" qr_code = QrCode() assert qr_code.qr_size is None @@ -46,9 +42,7 @@ def test_initializes_qr_code_with_empty_values(): def test_add_qr_size_updates_value(): - """ - Test that the add_qr_size method updates the qr_size attribute. - """ + """Test that the add_qr_size method updates the qr_size attribute.""" request = QrCode() request_updated = request.add_qr_size(200) @@ -57,9 +51,7 @@ def test_add_qr_size_updates_value(): def test_add_allow_multiple_updates_value(): - """ - Test that the add_allow_multiple method updates the allow_multiple attribute. - """ + """Test that the add_allow_multiple method updates the allow_multiple attribute.""" request = QrCode() request_updated = request.add_allow_multiple(True) @@ -68,9 +60,7 @@ def test_add_allow_multiple_updates_value(): def test_add_allow_change_amount_updates_value(): - """ - Test that the add_allow_change_amount method updates the allow_change_amount attribute. - """ + """Test that the add_allow_change_amount method updates the allow_change_amount attribute.""" request = QrCode() request_updated = request.add_allow_change_amount(False) @@ -79,9 +69,7 @@ def test_add_allow_change_amount_updates_value(): def test_add_min_amount_updates_value(): - """ - Test that the add_min_amount method updates the min_amount attribute. - """ + """Test that the add_min_amount method updates the min_amount attribute.""" request = QrCode() request_updated = request.add_min_amount(100) @@ -90,9 +78,7 @@ def test_add_min_amount_updates_value(): def test_add_max_amount_updates_value(): - """ - Test that the add_max_amount method updates the max_amount attribute. - """ + """Test that the add_max_amount method updates the max_amount attribute.""" request = QrCode() request_updated = request.add_max_amount(500) diff --git a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_qr_enabled.py b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_qr_enabled.py index 85ff97d..cae737e 100644 --- a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_qr_enabled.py +++ b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_qr_enabled.py @@ -14,27 +14,21 @@ def test_initializes_qr_enabled_correctly(): - """ - Test that the QrEnabled object is initialized correctly with a given value. - """ + """Test that the QrEnabled object is initialized correctly with a given value.""" qr_enabled = QrEnabled(qr_enabled=True) assert qr_enabled.qr_enabled is True def test_initializes_qr_enabled_with_empty_value(): - """ - Test that the QrEnabled object is initialized correctly with an empty value. - """ + """Test that the QrEnabled object is initialized correctly with an empty value.""" qr_enabled = QrEnabled() assert qr_enabled.qr_enabled is None def test_add_qr_enabled_updates_value(): - """ - Test that the add_qr_enabled method updates the qr_enabled attribute to True. - """ + """Test that the add_qr_enabled method updates the qr_enabled attribute to True.""" request = QrEnabled() request_updated = request.add_qr_enabled(True) @@ -43,9 +37,7 @@ def test_add_qr_enabled_updates_value(): def test_add_qr_enabled_with_false_value(): - """ - Test that the add_qr_enabled method updates the qr_enabled attribute to False. - """ + """Test that the add_qr_enabled method updates the qr_enabled attribute to False.""" request = QrEnabled() request_updated = request.add_qr_enabled(False) diff --git a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_terminal.py b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_terminal.py index 3b7fabe..42f1e43 100644 --- a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_terminal.py +++ b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_terminal.py @@ -14,27 +14,21 @@ def test_initializes_terminal_correctly(): - """ - Test that the Terminal object is initialized correctly with a given terminal_id. - """ + """Test that the Terminal object is initialized correctly with a given terminal_id.""" terminal = Terminal(terminal_id="12345") assert terminal.terminal_id == "12345" def test_initializes_terminal_with_empty_value(): - """ - Test that the Terminal object is initialized correctly with an empty value. - """ + """Test that the Terminal object is initialized correctly with an empty value.""" terminal = Terminal() assert terminal.terminal_id is None def test_add_terminal_id_updates_value(): - """ - Test that the add_terminal_id method updates the terminal_id attribute to the given value. - """ + """Test that the add_terminal_id method updates the terminal_id attribute to the given value.""" terminal = Terminal() terminal_updated = terminal.add_terminal_id("12345") @@ -43,9 +37,7 @@ def test_add_terminal_id_updates_value(): def test_add_terminal_id_with_empty_string(): - """ - Test that the add_terminal_id method updates the terminal_id attribute to an empty string. - """ + """Test that the add_terminal_id method updates the terminal_id attribute to an empty string.""" terminal = Terminal() terminal_updated = terminal.add_terminal_id("") diff --git a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_wallet.py b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_wallet.py index 2be19f1..366a4fe 100644 --- a/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_wallet.py +++ b/tests/multisafepay/unit/api/path/orders/request/components/gateway_info/test_unit_wallet.py @@ -14,27 +14,21 @@ def test_initializes_wallet_correctly(): - """ - Test that the Wallet object is initialized correctly with a given payment_token. - """ + """Test that the Wallet object is initialized correctly with a given payment_token.""" wallet = Wallet(payment_token="token123") assert wallet.payment_token == "token123" def test_initializes_wallet_with_empty_value(): - """ - Test that the Wallet object is initialized correctly with an empty value. - """ + """Test that the Wallet object is initialized correctly with an empty value.""" wallet = Wallet() assert wallet.payment_token is None def test_add_payment_token_updates_value(): - """ - Test that the add_payment_token method updates the payment_token attribute to the given value. - """ + """Test that the add_payment_token method updates the payment_token attribute to the given value.""" wallet = Wallet() wallet_updated = wallet.add_payment_token("token123") diff --git a/tests/multisafepay/unit/api/path/orders/request/components/test_unit_custom_info.py b/tests/multisafepay/unit/api/path/orders/request/components/test_unit_custom_info.py index f75ab47..bdfce81 100644 --- a/tests/multisafepay/unit/api/path/orders/request/components/test_unit_custom_info.py +++ b/tests/multisafepay/unit/api/path/orders/request/components/test_unit_custom_info.py @@ -14,9 +14,7 @@ def test_initializes_custom_info_correctly(): - """ - Tests that the CustomInfo object is initialized correctly with given values. - """ + """Tests that the CustomInfo object is initialized correctly with given values.""" custom_info = CustomInfo( custom1="value1", custom2="value2", @@ -29,9 +27,7 @@ def test_initializes_custom_info_correctly(): def test_initializes_custom_info_with_empty_values(): - """ - Tests that the CustomInfo object is initialized with None values when no arguments are provided. - """ + """Tests that the CustomInfo object is initialized with None values when no arguments are provided.""" custom_info = CustomInfo() assert custom_info.custom1 is None @@ -40,9 +36,7 @@ def test_initializes_custom_info_with_empty_values(): def test_add_custom1_updates_value(): - """ - Tests that the add_custom1 method updates the custom1 field correctly. - """ + """Tests that the add_custom1 method updates the custom1 field correctly.""" custom_info = CustomInfo() custom_info_updated = custom_info.add_custom1("value1") @@ -51,9 +45,7 @@ def test_add_custom1_updates_value(): def test_add_custom2_updates_value(): - """ - Tests that the add_custom2 method updates the custom2 field correctly. - """ + """Tests that the add_custom2 method updates the custom2 field correctly.""" custom_info = CustomInfo() custom_info_updated = custom_info.add_custom2("value2") @@ -62,9 +54,7 @@ def test_add_custom2_updates_value(): def test_add_custom3_updates_value(): - """ - Tests that the add_custom3 method updates the custom3 field correctly. - """ + """Tests that the add_custom3 method updates the custom3 field correctly.""" custom_info = CustomInfo() custom_info_updated = custom_info.add_custom3("value3") diff --git a/tests/multisafepay/unit/api/path/orders/request/components/test_unit_google_analytics.py b/tests/multisafepay/unit/api/path/orders/request/components/test_unit_google_analytics.py index 009a599..e50531b 100644 --- a/tests/multisafepay/unit/api/path/orders/request/components/test_unit_google_analytics.py +++ b/tests/multisafepay/unit/api/path/orders/request/components/test_unit_google_analytics.py @@ -14,27 +14,21 @@ def test_initializes_google_analytics_correctly(): - """ - Tests that the GoogleAnalytics object is initialized correctly with the given account ID. - """ + """Tests that the GoogleAnalytics object is initialized correctly with the given account ID.""" google_analytics = GoogleAnalytics(account_id="UA-12345678-1") assert google_analytics.account_id == "UA-12345678-1" def test_initializes_google_analytics_with_empty_value(): - """ - Tests that the GoogleAnalytics object is initialized with None when no account ID is provided. - """ + """Tests that the GoogleAnalytics object is initialized with None when no account ID is provided.""" google_analytics = GoogleAnalytics() assert google_analytics.account_id is None def test_add_account_id_updates_value(): - """ - Tests that the add_account_id method updates the account_id field correctly. - """ + """Tests that the add_account_id method updates the account_id field correctly.""" google_analytics = GoogleAnalytics() google_analytics_updated = google_analytics.add_account_id("UA-12345678-1") diff --git a/tests/multisafepay/unit/api/path/orders/request/components/test_unit_plugin.py b/tests/multisafepay/unit/api/path/orders/request/components/test_unit_plugin.py index 2469b0b..35f22df 100644 --- a/tests/multisafepay/unit/api/path/orders/request/components/test_unit_plugin.py +++ b/tests/multisafepay/unit/api/path/orders/request/components/test_unit_plugin.py @@ -14,9 +14,7 @@ def test_initializes_plugin_correctly(): - """ - Tests that the Plugin object is initialized correctly with the given values. - """ + """Tests that the Plugin object is initialized correctly with the given values.""" plugin = Plugin( plugin_version="1.0.0", shop_version="1.0.0", @@ -33,9 +31,7 @@ def test_initializes_plugin_correctly(): def test_initializes_plugin_with_empty_values(): - """ - Tests that the Plugin object is initialized with None values when no arguments are provided. - """ + """Tests that the Plugin object is initialized with None values when no arguments are provided.""" plugin = Plugin() assert plugin.plugin_version is None assert plugin.shop is None @@ -46,9 +42,7 @@ def test_initializes_plugin_with_empty_values(): def test_add_plugin_version_updates_value(): - """ - Tests that the add_plugin_version method updates the plugin_version field correctly. - """ + """Tests that the add_plugin_version method updates the plugin_version field correctly.""" plugin = Plugin() plugin_updated = plugin.add_plugin_version("1.0.0") @@ -57,9 +51,7 @@ def test_add_plugin_version_updates_value(): def test_add_shop_updates_value(): - """ - Tests that the add_shop method updates the shop field correctly. - """ + """Tests that the add_shop method updates the shop field correctly.""" plugin = Plugin() plugin_updated = plugin.add_shop("TestShop") @@ -68,9 +60,7 @@ def test_add_shop_updates_value(): def test_add_shop_version_updates_value(): - """ - Tests that the add_shop_version method updates the shop_version field correctly. - """ + """Tests that the add_shop_version method updates the shop_version field correctly.""" plugin = Plugin() plugin_updated = plugin.add_shop_version("1.0.0") @@ -79,9 +69,7 @@ def test_add_shop_version_updates_value(): def test_add_partner_updates_value(): - """ - Tests that the add_partner method updates the partner field correctly. - """ + """Tests that the add_partner method updates the partner field correctly.""" plugin = Plugin() plugin_updated = plugin.add_partner("TestPartner") @@ -90,9 +78,7 @@ def test_add_partner_updates_value(): def test_add_shop_root_url_updates_value(): - """ - Tests that the add_shop_root_url method updates the shop_root_url field correctly. - """ + """Tests that the add_shop_root_url method updates the shop_root_url field correctly.""" plugin = Plugin() plugin_updated = plugin.add_shop_root_url( "https://example.com", diff --git a/tests/multisafepay/unit/api/path/orders/request/components/test_unit_second_chance.py b/tests/multisafepay/unit/api/path/orders/request/components/test_unit_second_chance.py index 47f0423..38b94ab 100644 --- a/tests/multisafepay/unit/api/path/orders/request/components/test_unit_second_chance.py +++ b/tests/multisafepay/unit/api/path/orders/request/components/test_unit_second_chance.py @@ -14,27 +14,21 @@ def initializes_second_chance_correctly(): - """ - Tests that the SecondChance object is initialized correctly with the given value. - """ + """Tests that the SecondChance object is initialized correctly with the given value.""" second_chance = SecondChance(send_email=True) assert second_chance.send_email is True def initializes_second_chance_with_default_values(): - """ - Tests that the SecondChance object is initialized with the default value when no arguments are provided. - """ + """Tests that the SecondChance object is initialized with the default value when no arguments are provided.""" second_chance = SecondChance() assert second_chance.send_email is False def add_send_email_updates_value(): - """ - Tests that the add_send_email method updates the send_email field to True. - """ + """Tests that the add_send_email method updates the send_email field to True.""" second_chance = SecondChance() second_chance_updated = second_chance.add_send_email(True) @@ -43,9 +37,7 @@ def add_send_email_updates_value(): def add_send_email_updates_value_to_false(): - """ - Tests that the add_send_email method updates the send_email field to False. - """ + """Tests that the add_send_email method updates the send_email field to False.""" second_chance = SecondChance(send_email=True) second_chance_updated = second_chance.add_send_email(False) diff --git a/tests/multisafepay/unit/api/path/orders/request/test_unit_order_request.py b/tests/multisafepay/unit/api/path/orders/request/test_unit_order_request.py index a7e8be4..b4ace9c 100644 --- a/tests/multisafepay/unit/api/path/orders/request/test_unit_order_request.py +++ b/tests/multisafepay/unit/api/path/orders/request/test_unit_order_request.py @@ -15,9 +15,7 @@ def test_initializes_order_request_correctly(): - """ - Tests that the OrderRequest object is initialized correctly with the given values. - """ + """Tests that the OrderRequest object is initialized correctly with the given values.""" order_request = OrderRequest( type="direct", gateway="test_gateway", @@ -61,9 +59,7 @@ def test_initializes_order_request_correctly(): def test_initializes_order_request_with_default_values(): - """ - Tests that the OrderRequest object is initialized with default values when no arguments are provided. - """ + """Tests that the OrderRequest object is initialized with default values when no arguments are provided.""" order_request = OrderRequest() assert order_request.type is None @@ -92,9 +88,7 @@ def test_initializes_order_request_with_default_values(): def test_add_type_updates_value(): - """ - Tests that the add_type method updates the type field correctly. - """ + """Tests that the add_type method updates the type field correctly.""" order_request = OrderRequest() order_request_updated = order_request.add_type("direct") @@ -103,9 +97,7 @@ def test_add_type_updates_value(): def test_add_type_raises_exception_for_invalid_value(): - """ - Tests that the add_type method raises an InvalidArgumentException for an invalid type value. - """ + """Tests that the add_type method raises an InvalidArgumentException for an invalid type value.""" order_request = OrderRequest() with pytest.raises(InvalidArgumentException) as excinfo: order_request.add_type("invalid_type") @@ -116,9 +108,7 @@ def test_add_type_raises_exception_for_invalid_value(): def test_add_recurring_model_updates_value(): - """ - Tests that the add_recurring_model method updates the recurring_model field correctly. - """ + """Tests that the add_recurring_model method updates the recurring_model field correctly.""" order_request = OrderRequest() order_request_updated = order_request.add_recurring_model("subscription") @@ -127,9 +117,7 @@ def test_add_recurring_model_updates_value(): def test_add_recurring_model_raises_exception_for_invalid_value(): - """ - Tests that the add_recurring_model method raises an InvalidArgumentException for an invalid recurring_model value. - """ + """Tests that the add_recurring_model method raises an InvalidArgumentException for an invalid recurring_model value.""" order_request = OrderRequest() with pytest.raises(InvalidArgumentException) as excinfo: order_request.add_recurring_model("invalid_model") @@ -140,9 +128,7 @@ def test_add_recurring_model_raises_exception_for_invalid_value(): def test_add_order_id_updates_value(): - """ - Tests that the add_order_id method updates the order_id field correctly. - """ + """Tests that the add_order_id method updates the order_id field correctly.""" order_request = OrderRequest() order_request_updated = order_request.add_order_id("12345") @@ -151,9 +137,7 @@ def test_add_order_id_updates_value(): def test_add_currency_updates_value(): - """ - Tests that the add_currency method updates the currency field correctly. - """ + """Tests that the add_currency method updates the currency field correctly.""" order_request = OrderRequest() order_request_updated = order_request.add_currency("USD") @@ -162,9 +146,7 @@ def test_add_currency_updates_value(): def test_add_amount_updates_value(): - """ - Tests that the add_amount method updates the amount field correctly. - """ + """Tests that the add_amount method updates the amount field correctly.""" order_request = OrderRequest() order_request_updated = order_request.add_amount(1000) @@ -173,9 +155,7 @@ def test_add_amount_updates_value(): def test_add_gateway_updates_value(): - """ - Tests that the add_gateway method updates the gateway field correctly. - """ + """Tests that the add_gateway method updates the gateway field correctly.""" order_request = OrderRequest() order_request_updated = order_request.add_gateway("test_gateway") @@ -184,9 +164,7 @@ def test_add_gateway_updates_value(): def test_add_gateway_info_updates_value(): - """ - Tests that the add_gateway_info method updates the gateway_info field correctly. - """ + """Tests that the add_gateway_info method updates the gateway_info field correctly.""" order_request = OrderRequest() gateway_info = {"info": "test"} order_request_updated = order_request.add_gateway_info(gateway_info) @@ -196,9 +174,7 @@ def test_add_gateway_info_updates_value(): def test_add_description_updates_value(): - """ - Tests that the add_description method updates the description field correctly. - """ + """Tests that the add_description method updates the description field correctly.""" order_request = OrderRequest() order_request_updated = order_request.add_description("Test description") @@ -207,9 +183,7 @@ def test_add_description_updates_value(): def test_add_recurring_id_updates_value(): - """ - Tests that the add_recurring_id method updates the recurring_id field correctly. - """ + """Tests that the add_recurring_id method updates the recurring_id field correctly.""" order_request = OrderRequest() order_request_updated = order_request.add_recurring_id("rec123") @@ -218,9 +192,7 @@ def test_add_recurring_id_updates_value(): def test_add_seconds_active_updates_value(): - """ - Tests that the add_seconds_active method updates the seconds_active field correctly. - """ + """Tests that the add_seconds_active method updates the seconds_active field correctly.""" order_request = OrderRequest() order_request_updated = order_request.add_seconds_active(3600) @@ -229,9 +201,7 @@ def test_add_seconds_active_updates_value(): def test_add_days_active_updates_value(): - """ - Tests that the add_days_active method updates the days_active field correctly. - """ + """Tests that the add_days_active method updates the days_active field correctly.""" order_request = OrderRequest() order_request_updated = order_request.add_days_active(30) @@ -240,9 +210,7 @@ def test_add_days_active_updates_value(): def test_add_var1_updates_value(): - """ - Tests that the add_var1 method updates the var1 field correctly. - """ + """Tests that the add_var1 method updates the var1 field correctly.""" order_request = OrderRequest() order_request_updated = order_request.add_var1("var1") @@ -251,9 +219,7 @@ def test_add_var1_updates_value(): def test_add_var2_updates_value(): - """ - Tests that the add_var2 method updates the var2 field correctly. - """ + """Tests that the add_var2 method updates the var2 field correctly.""" order_request = OrderRequest() order_request_updated = order_request.add_var2("var2") @@ -262,9 +228,7 @@ def test_add_var2_updates_value(): def test_add_var3_updates_value(): - """ - Tests that the add_var3 method updates the var3 field correctly. - """ + """Tests that the add_var3 method updates the var3 field correctly.""" order_request = OrderRequest() order_request_updated = order_request.add_var3("var3") diff --git a/tests/multisafepay/unit/api/path/orders/response/components/test_unit_order_adjustment.py b/tests/multisafepay/unit/api/path/orders/response/components/test_unit_order_adjustment.py index 3088b49..917710a 100644 --- a/tests/multisafepay/unit/api/path/orders/response/components/test_unit_order_adjustment.py +++ b/tests/multisafepay/unit/api/path/orders/response/components/test_unit_order_adjustment.py @@ -14,9 +14,7 @@ def test_initializes_order_adjustment_correctly(): - """ - Tests that the OrderAdjustment object is initialized correctly with the given values. - """ + """Tests that the OrderAdjustment object is initialized correctly with the given values.""" order_adjustment = OrderAdjustment(total_adjustment=10.0, total_tax=2.0) assert order_adjustment.total_adjustment == 10.0 @@ -24,9 +22,7 @@ def test_initializes_order_adjustment_correctly(): def test_initializes_order_adjustment_with_empty_values(): - """ - Tests that the OrderAdjustment object is initialized with None values when no arguments are provided. - """ + """Tests that the OrderAdjustment object is initialized with None values when no arguments are provided.""" order_adjustment = OrderAdjustment() assert order_adjustment.total_adjustment is None @@ -34,9 +30,7 @@ def test_initializes_order_adjustment_with_empty_values(): def test_from_dict_creates_instance_with_correct_values(): - """ - Test that the from_dict method creates an OrderAdjustment instance with the correct values. - """ + """Test that the from_dict method creates an OrderAdjustment instance with the correct values.""" data = {"total_adjustment": 10.0, "total_tax": 2.0} order_adjustment = OrderAdjustment.from_dict(data) @@ -45,9 +39,7 @@ def test_from_dict_creates_instance_with_correct_values(): def test_from_dict_creates_instance_with_none_values(): - """ - Test that the from_dict method creates an OrderAdjustment instance with None values when no arguments are provided. - """ + """Test that the from_dict method creates an OrderAdjustment instance with None values when no arguments are provided.""" data = {} order_adjustment = OrderAdjustment.from_dict(data) @@ -56,9 +48,7 @@ def test_from_dict_creates_instance_with_none_values(): def test_from_dict_returns_none_for_none_input(): - """ - Test that the from_dict method returns None when no arguments are provided. - """ + """Test that the from_dict method returns None when no arguments are provided.""" order_adjustment = OrderAdjustment.from_dict(None) assert order_adjustment is None diff --git a/tests/multisafepay/unit/api/path/orders/response/components/test_unit_payment_details.py b/tests/multisafepay/unit/api/path/orders/response/components/test_unit_payment_details.py index 13a294b..cae9f25 100644 --- a/tests/multisafepay/unit/api/path/orders/response/components/test_unit_payment_details.py +++ b/tests/multisafepay/unit/api/path/orders/response/components/test_unit_payment_details.py @@ -14,9 +14,7 @@ def test_initialize_correctly(): - """ - Test that the PaymentDetails object is initialized correctly with all attributes. - """ + """Test that the PaymentDetails object is initialized correctly with all attributes.""" payment_details = PaymentDetails( account_holder_name="John Doe", account_id="acc123", @@ -65,9 +63,7 @@ def test_initialize_correctly(): def test_initialize_with_none_values(): - """ - Test that the PaymentDetails object is initialized correctly with None values for all attributes. - """ + """Test that the PaymentDetails object is initialized correctly with None values for all attributes.""" payment_details = PaymentDetails() assert payment_details.account_holder_name is None @@ -94,9 +90,7 @@ def test_initialize_with_none_values(): def test_from_dict_creates_payment_details_instance_with_correct_values(): - """ - Test that the PaymentDetails object is created correctly from a dictionary with all attributes. - """ + """Test that the PaymentDetails object is created correctly from a dictionary with all attributes.""" data = { "account_holder_name": "John Doe", "account_id": "acc123", @@ -146,9 +140,7 @@ def test_from_dict_creates_payment_details_instance_with_correct_values(): def test_from_dict_creates_payment_details_instance_with_none_values(): - """ - Test that the PaymentDetails object is created correctly from an empty dictionary with None values for all attributes. - """ + """Test that the PaymentDetails object is created correctly from an empty dictionary with None values for all attributes.""" data = {} payment_details = PaymentDetails.from_dict(data) @@ -176,9 +168,7 @@ def test_from_dict_creates_payment_details_instance_with_none_values(): def from_dict_returns_none_for_none_input(): - """ - Test that the PaymentDetails.from_dict method returns None when the input is None. - """ + """Test that the PaymentDetails.from_dict method returns None when the input is None.""" payment_details = PaymentDetails.from_dict(None) assert payment_details is None diff --git a/tests/multisafepay/unit/api/path/transactions/response/test_unit_transaction.py b/tests/multisafepay/unit/api/path/transactions/response/test_unit_transaction.py index d0cf252..4cc44f2 100644 --- a/tests/multisafepay/unit/api/path/transactions/response/test_unit_transaction.py +++ b/tests/multisafepay/unit/api/path/transactions/response/test_unit_transaction.py @@ -14,9 +14,7 @@ def test_initializes_transaction_correctly(): - """ - Test that a Transaction object is correctly initialized with given data. - """ + """Test that a Transaction object is correctly initialized with given data.""" transaction = Transaction( amount=1000, completed="2023-10-01", @@ -76,9 +74,7 @@ def test_initializes_transaction_correctly(): def test_initializes_transaction_empty(): - """ - Test that a Transaction object is correctly initialized with default values. - """ + """Test that a Transaction object is correctly initialized with default values.""" transaction = Transaction() assert transaction.amount is None assert transaction.completed is None @@ -110,9 +106,7 @@ def test_initializes_transaction_empty(): def test_initializes_transaction_from_dict(): - """ - Test that a Transaction object is correctly initialized from a dictionary. - """ + """Test that a Transaction object is correctly initialized from a dictionary.""" data = { "amount": 1000, "completed": "2023-10-01", @@ -173,9 +167,7 @@ def test_initializes_transaction_from_dict(): def test_initializes_transaction_with_none_values_from_dict(): - """ - Test that a Transaction object is correctly initialized from an empty dictionary. - """ + """Test that a Transaction object is correctly initialized from an empty dictionary.""" data = {} transaction = Transaction.from_dict(data) assert transaction.amount is None @@ -208,8 +200,6 @@ def test_initializes_transaction_with_none_values_from_dict(): def test_from_dict_returns_none_for_none_input_from_dict(): - """ - Test that the from_dict method returns None when given None as input. - """ + """Test that the from_dict method returns None when given None as input.""" transaction = Transaction.from_dict(None) assert transaction is None diff --git a/tests/multisafepay/unit/api/shared/cart/test_unit_cart_item.py b/tests/multisafepay/unit/api/shared/cart/test_unit_cart_item.py index 548cb68..1c91bf5 100644 --- a/tests/multisafepay/unit/api/shared/cart/test_unit_cart_item.py +++ b/tests/multisafepay/unit/api/shared/cart/test_unit_cart_item.py @@ -14,9 +14,7 @@ def test_initializes_with_default_values(): - """ - Test that a CartItem initializes with default values. - """ + """Test that a CartItem initializes with default values.""" item = CartItem() assert item.cashback is None assert item.currency is None @@ -33,63 +31,49 @@ def test_initializes_with_default_values(): def test_adds_cashback(): - """ - Test that cashback can be added to a CartItem. - """ + """Test that cashback can be added to a CartItem.""" item = CartItem() item.add_cashback("10%") assert item.cashback == "10%" def test_adds_currency(): - """ - Test that currency can be added to a CartItem. - """ + """Test that currency can be added to a CartItem.""" item = CartItem() item.add_currency("USD") assert item.currency == "USD" def test_adds_description(): - """ - Test that description can be added to a CartItem. - """ + """Test that description can be added to a CartItem.""" item = CartItem() item.add_description("A nice item") assert item.description == "A nice item" def test_adds_image(): - """ - Test that image URL can be added to a CartItem. - """ + """Test that image URL can be added to a CartItem.""" item = CartItem() item.add_image("http://example.com/image.png") assert item.image == "http://example.com/image.png" def test_adds_merchant_item_id(): - """ - Test that merchant item ID can be added to a CartItem. - """ + """Test that merchant item ID can be added to a CartItem.""" item = CartItem() item.add_merchant_item_id("12345") assert item.merchant_item_id == "12345" def test_adds_name(): - """ - Test that name can be added to a CartItem. - """ + """Test that name can be added to a CartItem.""" item = CartItem() item.add_name("Item Name") assert item.name == "Item Name" def test_adds_options(): - """ - Test that options can be added to a CartItem. - """ + """Test that options can be added to a CartItem.""" item = CartItem() options = [{"color": "red"}, {"size": "M"}] item.add_options(options) @@ -97,45 +81,35 @@ def test_adds_options(): def test_adds_product_url(): - """ - Test that product URL can be added to a CartItem. - """ + """Test that product URL can be added to a CartItem.""" item = CartItem() item.add_product_url("http://example.com/product") assert item.product_url == "http://example.com/product" def test_adds_quantity(): - """ - Test that quantity can be added to a CartItem. - """ + """Test that quantity can be added to a CartItem.""" item = CartItem() item.add_quantity(10) assert item.quantity == 10 def test_adds_tax_table_selector(): - """ - Test that tax table selector can be added to a CartItem. - """ + """Test that tax table selector can be added to a CartItem.""" item = CartItem() item.add_tax_table_selector("standard") assert item.tax_table_selector == "standard" def test_adds_unit_price(): - """ - Test that unit price can be added to a CartItem. - """ + """Test that unit price can be added to a CartItem.""" item = CartItem() item.add_unit_price(19.99) assert item.unit_price == 19.99 def test_creates_from_empty_dict(): - """ - Test that a CartItem can be created from an empty dictionary. - """ + """Test that a CartItem can be created from an empty dictionary.""" item = CartItem.from_dict({}) assert item.cashback is None assert item.currency is None @@ -152,107 +126,76 @@ def test_creates_from_empty_dict(): def test_creates_from_none(): - """ - Test that a CartItem is None when created from None. - """ + """Test that a CartItem is None when created from None.""" item = CartItem.from_dict(None) assert item is None def test_add_tax_rate(): - """ - Test that a tax rate can be added to a CartItem. - """ + """Test that a tax rate can be added to a CartItem.""" item = CartItem() item.add_tax_rate(0.21) assert item.tax_table_selector == "0.21" def test_add_tax_rate_invalid_negative(): - """ - Test that an InvalidArgumentException is raised when a negative tax rate is added to a CartItem. - - """ + """Test that an InvalidArgumentException is raised when a negative tax rate is added to a CartItem.""" item = CartItem() with pytest.raises(InvalidArgumentException): item.add_tax_rate(-0.21) def test_add_tax_rate_no_possible_string_parse(): - """ - Test that an InvalidArgumentException is raised when a non-numeric string is passed to add_tax_rate. - - """ + """Test that an InvalidArgumentException is raised when a non-numeric string is passed to add_tax_rate.""" item = CartItem() with pytest.raises(InvalidArgumentException): item.add_tax_rate(float("nan")) def test_add_tax_rate_infinite(): - """ - Test that an InvalidArgumentException is raised when an infinite value is passed to add_tax_rate. - - """ + """Test that an InvalidArgumentException is raised when an infinite value is passed to add_tax_rate.""" item = CartItem() with pytest.raises(InvalidArgumentException): item.add_tax_rate(float("inf")) def test_add_tax_rate_percentage_invalid_negative(): - """ - Test that an InvalidArgumentException is raised when a negative tax rate percentage is added to a CartItem. - - """ + """Test that an InvalidArgumentException is raised when a negative tax rate percentage is added to a CartItem.""" item = CartItem() with pytest.raises(InvalidArgumentException): item.add_tax_rate_percentage(-5.0) def test_add_tax_rate_percentage_no_possible_string_parse(): - """ - Test that an InvalidArgumentException is raised when NaN is passed as the tax rate percentage to a CartItem. - - """ + """Test that an InvalidArgumentException is raised when NaN is passed as the tax rate percentage to a CartItem.""" item = CartItem() with pytest.raises(InvalidArgumentException): item.add_tax_rate_percentage(float("nan")) def test_add_tax_rate_percentage_infinite(): - """ - Test that an InvalidArgumentException is raised when an infinite value is passed as the tax rate percentage to a CartItem. - - """ + """Test that an InvalidArgumentException is raised when an infinite value is passed as the tax rate percentage to a CartItem.""" item = CartItem() with pytest.raises(InvalidArgumentException): item.add_tax_rate_percentage(float("inf")) def test_add_tax_rate_percentage(): - """ - Test that a valid tax rate percentage is correctly set as the tax table selector in a CartItem. - - """ + """Test that a valid tax rate percentage is correctly set as the tax table selector in a CartItem.""" item = CartItem() item.add_tax_rate_percentage(21) assert item.tax_table_selector == "0.21" def test_add_tax_rate_percentage(): - """ - Test that a 0 tax rate percentage is correctly set as the tax table selector in a CartItem. - - """ + """Test that a 0 tax rate percentage is correctly set as the tax table selector in a CartItem.""" item = CartItem() item.add_tax_rate_percentage(0) assert item.tax_table_selector == "0.0" def test_add_tax_rate_percentage(): - """ - Test that a 0.0 tax rate percentage is correctly set as the tax table selector in a CartItem. - - """ + """Test that a 0.0 tax rate percentage is correctly set as the tax table selector in a CartItem.""" item = CartItem() item.add_tax_rate_percentage(0.0) assert item.tax_table_selector == "0.0" diff --git a/tests/multisafepay/unit/api/shared/cart/test_unit_shopping_cart.py b/tests/multisafepay/unit/api/shared/cart/test_unit_shopping_cart.py index 73d3bb9..c705a22 100644 --- a/tests/multisafepay/unit/api/shared/cart/test_unit_shopping_cart.py +++ b/tests/multisafepay/unit/api/shared/cart/test_unit_shopping_cart.py @@ -12,25 +12,19 @@ def test_initializes_with_default_values(): - """ - Test that a ShoppingCart initializes with default values. - """ + """Test that a ShoppingCart initializes with default values.""" cart = ShoppingCart() assert cart.items is None def test_creates_from_dict_without_items(): - """ - Test that a ShoppingCart can be created from a dictionary without items. - """ + """Test that a ShoppingCart can be created from a dictionary without items.""" data = {} cart = ShoppingCart.from_dict(data) assert cart.items is None def test_creates_from_none(): - """ - Test that a ShoppingCart is None when created from None. - """ + """Test that a ShoppingCart is None when created from None.""" cart = ShoppingCart.from_dict(None) assert cart is None diff --git a/tests/multisafepay/unit/api/shared/checkout/test_unit_checkout_options.py b/tests/multisafepay/unit/api/shared/checkout/test_unit_checkout_options.py index 33f93a9..4662974 100644 --- a/tests/multisafepay/unit/api/shared/checkout/test_unit_checkout_options.py +++ b/tests/multisafepay/unit/api/shared/checkout/test_unit_checkout_options.py @@ -13,18 +13,14 @@ def test_initializes_with_default_values(): - """ - Test that a CheckoutOptions instance initializes with default values. - """ + """Test that a CheckoutOptions instance initializes with default values.""" checkout_options = CheckoutOptions() assert checkout_options.default is None assert checkout_options.alternate is None def test_creates_from_empty_dict(): - """ - Test that a CheckoutOptions instance is created from an empty dictionary. - """ + """Test that a CheckoutOptions instance is created from an empty dictionary.""" data = {} checkout_options = CheckoutOptions.from_dict(data) assert checkout_options.default is None @@ -32,8 +28,6 @@ def test_creates_from_empty_dict(): def test_creates_from_none(): - """ - Test that a CheckoutOptions instance is created from None. - """ + """Test that a CheckoutOptions instance is created from None.""" checkout_options = CheckoutOptions.from_dict(None) assert checkout_options is None diff --git a/tests/multisafepay/unit/api/shared/checkout/test_unit_default_tax_rate.py b/tests/multisafepay/unit/api/shared/checkout/test_unit_default_tax_rate.py index e65e486..a668d3b 100644 --- a/tests/multisafepay/unit/api/shared/checkout/test_unit_default_tax_rate.py +++ b/tests/multisafepay/unit/api/shared/checkout/test_unit_default_tax_rate.py @@ -13,27 +13,21 @@ def test_initializes_with_valid_values(): - """ - Test that a DefaultTaxRate instance initializes with valid values. - """ + """Test that a DefaultTaxRate instance initializes with valid values.""" default_tax_rate = DefaultTaxRate(rate=21, shipping_taxed=True) assert default_tax_rate.rate == 21 assert default_tax_rate.shipping_taxed is True def test_initializes_with_default_values(): - """ - Test that a DefaultTaxRate instance initializes with default values. - """ + """Test that a DefaultTaxRate instance initializes with default values.""" default_tax_rate = DefaultTaxRate() assert default_tax_rate.rate is None assert default_tax_rate.shipping_taxed is None def test_creates_from_dict_with_rate_and_shipping_taxed(): - """ - Test that a DefaultTaxRate instance is created from a dictionary with rate and shipping taxed. - """ + """Test that a DefaultTaxRate instance is created from a dictionary with rate and shipping taxed.""" data = {"rate": 21, "shipping_taxed": True} default_tax_rate = DefaultTaxRate.from_dict(data) assert default_tax_rate.rate == 21 @@ -41,9 +35,7 @@ def test_creates_from_dict_with_rate_and_shipping_taxed(): def test_creates_from_dict_with_only_rate(): - """ - Test that a DefaultTaxRate instance is created from a dictionary with only rate. - """ + """Test that a DefaultTaxRate instance is created from a dictionary with only rate.""" data = {"rate": 21} default_tax_rate = DefaultTaxRate.from_dict(data) assert default_tax_rate.rate == 21 @@ -51,9 +43,7 @@ def test_creates_from_dict_with_only_rate(): def test_creates_from_dict_with_only_shipping_taxed(): - """ - Test that a DefaultTaxRate instance is created from a dictionary with only shipping taxed. - """ + """Test that a DefaultTaxRate instance is created from a dictionary with only shipping taxed.""" data = {"shipping_taxed": True} default_tax_rate = DefaultTaxRate.from_dict(data) assert default_tax_rate.rate is None @@ -61,9 +51,7 @@ def test_creates_from_dict_with_only_shipping_taxed(): def test_creates_from_empty_dict(): - """ - Test that a DefaultTaxRate instance is created from an empty dictionary. - """ + """Test that a DefaultTaxRate instance is created from an empty dictionary.""" data = {} default_tax_rate = DefaultTaxRate.from_dict(data) assert default_tax_rate.rate is None @@ -71,26 +59,20 @@ def test_creates_from_empty_dict(): def test_creates_from_none(): - """ - Test that a DefaultTaxRate instance is created from None. - """ + """Test that a DefaultTaxRate instance is created from None.""" default_tax_rate = DefaultTaxRate.from_dict(None) assert default_tax_rate is None def test_adds_rate(): - """ - Test that a rate is added to a DefaultTaxRate instance. - """ + """Test that a rate is added to a DefaultTaxRate instance.""" default_tax_rate = DefaultTaxRate() default_tax_rate.add_rate(21) assert default_tax_rate.rate == 21 def test_adds_shipping_taxed(): - """ - Test that shipping taxed information is added to a DefaultTaxRate instance. - """ + """Test that shipping taxed information is added to a DefaultTaxRate instance.""" default_tax_rate = DefaultTaxRate() default_tax_rate.add_shipping_taxed(True) assert default_tax_rate.shipping_taxed is True diff --git a/tests/multisafepay/unit/api/shared/checkout/test_unit_tax_rate.py b/tests/multisafepay/unit/api/shared/checkout/test_unit_tax_rate.py index 2ebd9ae..618df41 100644 --- a/tests/multisafepay/unit/api/shared/checkout/test_unit_tax_rate.py +++ b/tests/multisafepay/unit/api/shared/checkout/test_unit_tax_rate.py @@ -13,27 +13,21 @@ def test_initializes_with_valid_values(): - """ - Test that a TaxRate instance initializes with valid values. - """ + """Test that a TaxRate instance initializes with valid values.""" tax_rate = TaxRate(rate=21, country="NL") assert tax_rate.rate == 21 assert tax_rate.country == "NL" def test_initializes_with_default_values(): - """ - Test that a TaxRate instance initializes with default values. - """ + """Test that a TaxRate instance initializes with default values.""" tax_rate = TaxRate() assert tax_rate.rate is None assert tax_rate.country == "" def test_creates_from_dict_with_rate_and_country(): - """ - Test that a TaxRate instance is created from a dictionary with rate and country. - """ + """Test that a TaxRate instance is created from a dictionary with rate and country.""" data = {"rate": 21, "country": "NL"} tax_rate = TaxRate.from_dict(data) assert tax_rate.rate == 21 @@ -41,9 +35,7 @@ def test_creates_from_dict_with_rate_and_country(): def test_creates_from_dict_with_only_rate(): - """ - Test that a TaxRate instance is created from a dictionary with only rate. - """ + """Test that a TaxRate instance is created from a dictionary with only rate.""" data = {"rate": 21} tax_rate = TaxRate.from_dict(data) assert tax_rate.rate == 21 @@ -51,9 +43,7 @@ def test_creates_from_dict_with_only_rate(): def test_creates_from_dict_with_only_country(): - """ - Test that a TaxRate instance is created from a dictionary with only country. - """ + """Test that a TaxRate instance is created from a dictionary with only country.""" data = {"country": "NL"} tax_rate = TaxRate.from_dict(data) assert tax_rate.rate is None @@ -61,9 +51,7 @@ def test_creates_from_dict_with_only_country(): def test_creates_from_empty_dict(): - """ - Test that a TaxRate instance is created from an empty dictionary. - """ + """Test that a TaxRate instance is created from an empty dictionary.""" data = {} tax_rate = TaxRate.from_dict(data) assert tax_rate.rate is None @@ -71,26 +59,20 @@ def test_creates_from_empty_dict(): def test_creates_from_none(): - """ - Test that a TaxRate instance is created from None. - """ + """Test that a TaxRate instance is created from None.""" tax_rate = TaxRate.from_dict(None) assert tax_rate is None def test_adds_rate(): - """ - Test that a rate is added to a TaxRate instance. - """ + """Test that a rate is added to a TaxRate instance.""" tax_rate = TaxRate() tax_rate.add_rate(21) assert tax_rate.rate == 21 def test_adds_country(): - """ - Test that a country is added to a TaxRate instance. - """ + """Test that a country is added to a TaxRate instance.""" tax_rate = TaxRate() tax_rate.add_country("NL") assert tax_rate.country == "NL" diff --git a/tests/multisafepay/unit/api/shared/checkout/test_unit_tax_rule.py b/tests/multisafepay/unit/api/shared/checkout/test_unit_tax_rule.py index 8c1b3bb..370c5b7 100644 --- a/tests/multisafepay/unit/api/shared/checkout/test_unit_tax_rule.py +++ b/tests/multisafepay/unit/api/shared/checkout/test_unit_tax_rule.py @@ -12,9 +12,7 @@ def test_initializes_with_default_values(): - """ - Test that a TaxRule instance initializes with default values. - """ + """Test that a TaxRule instance initializes with default values.""" tax_rule = TaxRule() assert tax_rule.name is None assert tax_rule.rules is None @@ -22,9 +20,7 @@ def test_initializes_with_default_values(): def test_creates_from_dict_with_only_name(): - """ - Test that a TaxRule instance is created from a dictionary with only a name. - """ + """Test that a TaxRule instance is created from a dictionary with only a name.""" data = {"name": "Standard Tax"} tax_rule = TaxRule.from_dict(data) assert tax_rule.name == "Standard Tax" @@ -32,9 +28,7 @@ def test_creates_from_dict_with_only_name(): def test_creates_from_empty_dict(): - """ - Test that a TaxRule instance is created from an empty dictionary. - """ + """Test that a TaxRule instance is created from an empty dictionary.""" data = {} tax_rule = TaxRule.from_dict(data) assert tax_rule.name is None @@ -42,17 +36,13 @@ def test_creates_from_empty_dict(): def test_creates_from_none(): - """ - Test that a TaxRule instance is created from None. - """ + """Test that a TaxRule instance is created from None.""" tax_rule = TaxRule.from_dict(None) assert tax_rule is None def test_adds_standalone(): - """ - Test that standalone information is added to a TaxRule instance. - """ + """Test that standalone information is added to a TaxRule instance.""" tax_rule = TaxRule() tax_rule.add_standalone(True) assert tax_rule.standalone is True diff --git a/tests/multisafepay/unit/api/shared/test_unit_costs.py b/tests/multisafepay/unit/api/shared/test_unit_costs.py index 20c916d..0e1c23e 100644 --- a/tests/multisafepay/unit/api/shared/test_unit_costs.py +++ b/tests/multisafepay/unit/api/shared/test_unit_costs.py @@ -13,9 +13,7 @@ def test_initializes_with_valid_values(): - """ - Test that a Costs instance initializes with valid values. - """ + """Test that a Costs instance initializes with valid values.""" costs = Costs( transaction_id=123, description="Service Fee", @@ -33,9 +31,7 @@ def test_initializes_with_valid_values(): def test_initializes_with_default_values(): - """ - Test that a Costs instance initializes with default values. - """ + """Test that a Costs instance initializes with default values.""" costs = Costs() assert costs.transaction_id is None assert costs.description is None @@ -46,57 +42,43 @@ def test_initializes_with_default_values(): def test_adds_transaction_id(): - """ - Test that a transaction ID is added to a Costs instance. - """ + """Test that a transaction ID is added to a Costs instance.""" costs = Costs().add_transaction_id(123) assert costs.transaction_id == 123 def test_adds_description(): - """ - Test that a description is added to a Costs instance. - """ + """Test that a description is added to a Costs instance.""" costs = Costs().add_description("Service Fee") assert costs.description == "Service Fee" def test_adds_type(): - """ - Test that a type is added to a Costs instance. - """ + """Test that a type is added to a Costs instance.""" costs = Costs().add_type("Fixed") assert costs.type == "Fixed" def test_adds_amount(): - """ - Test that an amount is added to a Costs instance. - """ + """Test that an amount is added to a Costs instance.""" costs = Costs().add_amount(99.99) assert costs.amount == 99.99 def test_adds_currency(): - """ - Test that a currency is added to a Costs instance. - """ + """Test that a currency is added to a Costs instance.""" costs = Costs().add_currency("USD") assert costs.currency == "USD" def test_adds_status(): - """ - Test that a status is added to a Costs instance. - """ + """Test that a status is added to a Costs instance.""" costs = Costs().add_status("Pending") assert costs.status == "Pending" def test_creates_from_dict_with_all_fields(): - """ - Test that a Costs instance is created from a dictionary with all fields. - """ + """Test that a Costs instance is created from a dictionary with all fields.""" data = { "transaction_id": 123, "description": "Service Fee", @@ -115,9 +97,7 @@ def test_creates_from_dict_with_all_fields(): def test_creates_from_empty_dict(): - """ - Test that a Costs instance is created from an empty dictionary. - """ + """Test that a Costs instance is created from an empty dictionary.""" data = {} costs = Costs.from_dict(data) assert costs.transaction_id is None @@ -129,8 +109,6 @@ def test_creates_from_empty_dict(): def test_creates_from_none(): - """ - Test that a Costs instance is created from None. - """ + """Test that a Costs instance is created from None.""" costs = Costs.from_dict(None) assert costs is None diff --git a/tests/multisafepay/unit/api/shared/test_unit_customer.py b/tests/multisafepay/unit/api/shared/test_unit_customer.py index dee5fea..e90961b 100644 --- a/tests/multisafepay/unit/api/shared/test_unit_customer.py +++ b/tests/multisafepay/unit/api/shared/test_unit_customer.py @@ -13,9 +13,7 @@ def test_initializes_with_valid_values(): - """ - Test that a Customer instance initializes with valid values. - """ + """Test that a Customer instance initializes with valid values.""" customer = Customer( locale="en_US", ip_address="10.1.0.1", @@ -54,9 +52,7 @@ def test_initializes_with_valid_values(): def test_initializes_with_default_values(): - """ - Test that a Customer instance initializes with default values. - """ + """Test that a Customer instance initializes with default values.""" customer = Customer() assert customer.locale is None assert customer.ip_address is None @@ -66,97 +62,73 @@ def test_initializes_with_default_values(): def test_adds_locale(): - """ - Test that a locale is added to the Customer instance. - """ + """Test that a locale is added to the Customer instance.""" customer = Customer().add_locale("en_US") assert customer.locale == "en_US" def test_adds_referrer(): - """ - Test that a referrer URL is added to the Customer instance. - """ + """Test that a referrer URL is added to the Customer instance.""" customer = Customer().add_referrer("http://example.com") assert customer.referrer == "http://example.com" def test_adds_user_agent(): - """ - Test that a user agent string is added to the Customer instance. - """ + """Test that a user agent string is added to the Customer instance.""" customer = Customer().add_user_agent("Mozilla/5.0") assert customer.user_agent == "Mozilla/5.0" def test_adds_first_name(): - """ - Test that a first name is added to the Customer instance. - """ + """Test that a first name is added to the Customer instance.""" customer = Customer().add_first_name("John") assert customer.first_name == "John" def test_adds_last_name(): - """ - Test that a last name is added to the Customer instance. - """ + """Test that a last name is added to the Customer instance.""" customer = Customer().add_last_name("Doe") assert customer.last_name == "Doe" def test_adds_address1(): - """ - Test that an address1 is added to the Customer instance. - """ + """Test that an address1 is added to the Customer instance.""" customer = Customer().add_address1("123 Main St") assert customer.address1 == "123 Main St" def test_adds_address2(): - """ - Test that an address2 is added to the Customer instance. - """ + """Test that an address2 is added to the Customer instance.""" customer = Customer().add_address2("Apt 4") assert customer.address2 == "Apt 4" def test_adds_house_number(): - """ - Test that a house number is added to the Customer instance. - """ + """Test that a house number is added to the Customer instance.""" customer = Customer().add_house_number("123") assert customer.house_number == "123" def test_adds_zip_code(): - """ - Test that a zip code is added to the Customer instance. - """ + """Test that a zip code is added to the Customer instance.""" customer = Customer().add_zip_code("12345") assert customer.zip_code == "12345" def test_adds_city(): - """ - Test that a city is added to the Customer instance. - """ + """Test that a city is added to the Customer instance.""" customer = Customer().add_city("Anytown") assert customer.city == "Anytown" def test_adds_state(): - """ - Test that a state is added to the Customer instance. - """ + """Test that a state is added to the Customer instance.""" customer = Customer().add_state("CA") assert customer.state == "CA" def test_creates_from_dict_with_all_fields(): - """ - Test that a Customer instance is created from a dictionary with all fields. - """ + """Test that a Customer instance is created from a dictionary with all fields.""" data = { "locale": "en_US", "ip_address": "192.168.0.1", @@ -195,9 +167,7 @@ def test_creates_from_dict_with_all_fields(): def test_creates_from_empty_dict(): - """ - Test that a Customer instance is created from an empty dictionary. - """ + """Test that a Customer instance is created from an empty dictionary.""" data = {} customer = Customer.from_dict(data) assert customer.locale is None @@ -208,8 +178,6 @@ def test_creates_from_empty_dict(): def test_creates_from_none(): - """ - Test that a Customer instance is created from None. - """ + """Test that a Customer instance is created from None.""" customer = Customer.from_dict(None) assert customer is None diff --git a/tests/multisafepay/unit/api/shared/test_unit_delivery.py b/tests/multisafepay/unit/api/shared/test_unit_delivery.py index 608155c..d171a3c 100644 --- a/tests/multisafepay/unit/api/shared/test_unit_delivery.py +++ b/tests/multisafepay/unit/api/shared/test_unit_delivery.py @@ -13,9 +13,7 @@ def test_initializes_with_valid_values(): - """ - Test that a Delivery instance initializes with valid values. - """ + """Test that a Delivery instance initializes with valid values.""" delivery = Delivery( first_name="John", last_name="Doe", @@ -43,9 +41,7 @@ def test_initializes_with_valid_values(): def test_initializes_with_default_values(): - """ - Test that a Delivery instance initializes with default values. - """ + """Test that a Delivery instance initializes with default values.""" delivery = Delivery() assert delivery.first_name is None assert delivery.last_name is None @@ -61,73 +57,55 @@ def test_initializes_with_default_values(): def test_adds_first_name(): - """ - Test that a first name is added to the Delivery instance. - """ + """Test that a first name is added to the Delivery instance.""" delivery = Delivery().add_first_name("John") assert delivery.first_name == "John" def test_adds_last_name(): - """ - Test that a last name is added to the Delivery instance. - """ + """Test that a last name is added to the Delivery instance.""" delivery = Delivery().add_last_name("Doe") assert delivery.last_name == "Doe" def test_adds_address1(): - """ - Test that a primary address line is added to the Delivery instance. - """ + """Test that a primary address line is added to the Delivery instance.""" delivery = Delivery().add_address1("123 Main St") assert delivery.address1 == "123 Main St" def test_adds_address2(): - """ - Test that a secondary address line is added to the Delivery instance. - """ + """Test that a secondary address line is added to the Delivery instance.""" delivery = Delivery().add_address2("Apt 4") assert delivery.address2 == "Apt 4" def test_adds_house_number(): - """ - Test that a house number is added to the Delivery instance. - """ + """Test that a house number is added to the Delivery instance.""" delivery = Delivery().add_house_number("123") assert delivery.house_number == "123" def test_adds_zip_code(): - """ - Test that a postal code is added to the Delivery instance. - """ + """Test that a postal code is added to the Delivery instance.""" delivery = Delivery().add_zip_code("12345") assert delivery.zip_code == "12345" def test_adds_city(): - """ - Test that a city is added to the Delivery instance. - """ + """Test that a city is added to the Delivery instance.""" delivery = Delivery().add_city("Anytown") assert delivery.city == "Anytown" def test_adds_state(): - """ - Test that a state or province is added to the Delivery instance. - """ + """Test that a state or province is added to the Delivery instance.""" delivery = Delivery().add_state("CA") assert delivery.state == "CA" def test_creates_from_dict_with_all_fields(): - """ - Test that a Delivery instance is created from a dictionary with all fields. - """ + """Test that a Delivery instance is created from a dictionary with all fields.""" data = { "first_name": "John", "last_name": "Doe", @@ -156,9 +134,7 @@ def test_creates_from_dict_with_all_fields(): def test_creates_from_empty_dict(): - """ - Test that a Delivery instance is created from an empty dictionary. - """ + """Test that a Delivery instance is created from an empty dictionary.""" data = {} delivery = Delivery.from_dict(data) assert delivery.first_name is None @@ -175,8 +151,6 @@ def test_creates_from_empty_dict(): def test_creates_from_none(): - """ - Test that a Delivery instance is created from None. - """ + """Test that a Delivery instance is created from None.""" delivery = Delivery.from_dict(None) assert delivery is None diff --git a/tests/multisafepay/unit/api/shared/test_unit_description.py b/tests/multisafepay/unit/api/shared/test_unit_description.py index ceba04d..7f129b7 100644 --- a/tests/multisafepay/unit/api/shared/test_unit_description.py +++ b/tests/multisafepay/unit/api/shared/test_unit_description.py @@ -13,41 +13,31 @@ def test_initializes_with_default_values(): - """ - Test that a Description instance initializes with default values. - """ + """Test that a Description instance initializes with default values.""" description = Description() assert description.description is None def test_adds_description_text(): - """ - Test that a description text is added to the Description instance. - """ + """Test that a description text is added to the Description instance.""" description = Description().add_description("Sample description") assert description.description == "Sample description" def test_gets_description_text(): - """ - Test that the description text is retrieved from the Description instance. - """ + """Test that the description text is retrieved from the Description instance.""" description = Description().add_description("Sample description") assert description.get() == "Sample description" def test_strips_html_tags(): - """ - Test that HTML tags are stripped from a given text. - """ + """Test that HTML tags are stripped from a given text.""" text = "

This is a test description.

" stripped_text = Description.strip_tags(text) assert stripped_text == "This is a test description." def test_creates_from_text(): - """ - Test that a Description instance is created from a given text. - """ + """Test that a Description instance is created from a given text.""" description = Description.from_text("Sample description") assert description.description == "Sample description" diff --git a/tests/multisafepay/unit/api/shared/test_unit_shared_custom_info.py b/tests/multisafepay/unit/api/shared/test_unit_shared_custom_info.py index f8219ba..3dcdda3 100644 --- a/tests/multisafepay/unit/api/shared/test_unit_shared_custom_info.py +++ b/tests/multisafepay/unit/api/shared/test_unit_shared_custom_info.py @@ -13,9 +13,7 @@ def test_initializes_with_valid_values(): - """ - Test that a CustomInfo instance initializes with valid values. - """ + """Test that a CustomInfo instance initializes with valid values.""" custom_info = CustomInfo( custom_1="Info 1", custom_2="Info 2", @@ -27,9 +25,7 @@ def test_initializes_with_valid_values(): def test_initializes_with_default_values(): - """ - Test that a CustomInfo instance initializes with default values. - """ + """Test that a CustomInfo instance initializes with default values.""" custom_info = CustomInfo() assert custom_info.custom_1 is None assert custom_info.custom_2 is None @@ -37,33 +33,25 @@ def test_initializes_with_default_values(): def test_adds_custom_1(): - """ - Test that custom information is added to the first field. - """ + """Test that custom information is added to the first field.""" custom_info = CustomInfo().add_custom_1("Info 1") assert custom_info.custom_1 == "Info 1" def test_adds_custom_2(): - """ - Test that custom information is added to the second field. - """ + """Test that custom information is added to the second field.""" custom_info = CustomInfo().add_custom_2("Info 2") assert custom_info.custom_2 == "Info 2" def test_adds_custom_3(): - """ - Test that custom information is added to the third field. - """ + """Test that custom information is added to the third field.""" custom_info = CustomInfo().add_custom_3("Info 3") assert custom_info.custom_3 == "Info 3" def test_creates_from_dict_with_all_fields(): - """ - Test that a CustomInfo instance is created from a dictionary with all fields. - """ + """Test that a CustomInfo instance is created from a dictionary with all fields.""" data = {"custom_1": "Info 1", "custom_2": "Info 2", "custom_3": "Info 3"} custom_info = CustomInfo.from_dict(data) assert custom_info.custom_1 == "Info 1" @@ -72,9 +60,7 @@ def test_creates_from_dict_with_all_fields(): def test_creates_from_dict_with_some_fields(): - """ - Test that a CustomInfo instance is created from a dictionary with some fields. - """ + """Test that a CustomInfo instance is created from a dictionary with some fields.""" data = {"custom_1": "Info 1", "custom_3": "Info 3"} custom_info = CustomInfo.from_dict(data) assert custom_info.custom_1 == "Info 1" @@ -83,9 +69,7 @@ def test_creates_from_dict_with_some_fields(): def test_creates_from_empty_dict(): - """ - Test that a CustomInfo instance is created from an empty dictionary. - """ + """Test that a CustomInfo instance is created from an empty dictionary.""" data = {} custom_info = CustomInfo.from_dict(data) assert custom_info.custom_1 is None @@ -94,8 +78,6 @@ def test_creates_from_empty_dict(): def test_creates_from_none(): - """ - Test that a CustomInfo instance is created from None. - """ + """Test that a CustomInfo instance is created from None.""" custom_info = CustomInfo.from_dict(None) assert custom_info is None diff --git a/tests/multisafepay/unit/api/shared/test_unit_shared_payment_method.py b/tests/multisafepay/unit/api/shared/test_unit_shared_payment_method.py index a3c0969..550e89a 100644 --- a/tests/multisafepay/unit/api/shared/test_unit_shared_payment_method.py +++ b/tests/multisafepay/unit/api/shared/test_unit_shared_payment_method.py @@ -13,9 +13,7 @@ def test_initializes_with_valid_values(): - """ - Test that a PaymentMethod instance initializes with valid values. - """ + """Test that a PaymentMethod instance initializes with valid values.""" payment_method = PaymentMethod( account_id="12345", amount=100.0, @@ -37,9 +35,7 @@ def test_initializes_with_valid_values(): def test_initializes_with_default_values(): - """ - Test that a PaymentMethod instance initializes with default values. - """ + """Test that a PaymentMethod instance initializes with default values.""" payment_method = PaymentMethod() assert payment_method.account_id is None assert payment_method.amount is None @@ -52,33 +48,25 @@ def test_initializes_with_default_values(): def test_adds_account_id(): - """ - Test that an account ID is added to the PaymentMethod instance. - """ + """Test that an account ID is added to the PaymentMethod instance.""" payment_method = PaymentMethod().add_account_id("12345") assert payment_method.account_id == "12345" def test_adds_amount(): - """ - Test that an amount is added to the PaymentMethod instance. - """ + """Test that an amount is added to the PaymentMethod instance.""" payment_method = PaymentMethod().add_amount(100.0) assert payment_method.amount == 100.0 def test_adds_currency(): - """ - Test that a currency is added to the PaymentMethod instance. - """ + """Test that a currency is added to the PaymentMethod instance.""" payment_method = PaymentMethod().add_currency("USD") assert payment_method.currency == "USD" def test_adds_description(): - """ - Test that a description is added to the PaymentMethod instance. - """ + """Test that a description is added to the PaymentMethod instance.""" payment_method = PaymentMethod().add_description( "Payment for order #12345", ) @@ -86,41 +74,31 @@ def test_adds_description(): def test_adds_external_transaction_id(): - """ - Test that an external transaction ID is added to the PaymentMethod instance. - """ + """Test that an external transaction ID is added to the PaymentMethod instance.""" payment_method = PaymentMethod().add_external_transaction_id("txn_12345") assert payment_method.external_transaction_id == "txn_12345" def test_adds_payment_description(): - """ - Test that a payment description is added to the PaymentMethod instance. - """ + """Test that a payment description is added to the PaymentMethod instance.""" payment_method = PaymentMethod().add_payment_description("Order payment") assert payment_method.payment_description == "Order payment" def test_adds_status(): - """ - Test that a status is added to the PaymentMethod instance. - """ + """Test that a status is added to the PaymentMethod instance.""" payment_method = PaymentMethod().add_status("completed") assert payment_method.status == "completed" def test_adds_type(): - """ - Test that a type is added to the PaymentMethod instance. - """ + """Test that a type is added to the PaymentMethod instance.""" payment_method = PaymentMethod().add_type("credit_card") assert payment_method.type == "credit_card" def test_creates_from_dict_with_all_fields(): - """ - Test that a PaymentMethod instance is created from a dictionary with all fields. - """ + """Test that a PaymentMethod instance is created from a dictionary with all fields.""" data = { "account_id": "12345", "amount": 100.0, @@ -143,9 +121,7 @@ def test_creates_from_dict_with_all_fields(): def test_creates_from_empty_dict(): - """ - Test that a PaymentMethod instance is created from an empty dictionary. - """ + """Test that a PaymentMethod instance is created from an empty dictionary.""" data = {} payment_method = PaymentMethod.from_dict(data) assert payment_method.account_id is None @@ -159,8 +135,6 @@ def test_creates_from_empty_dict(): def test_creates_from_none(): - """ - Test that None is returned when creating a PaymentMethod instance from None. - """ + """Test that None is returned when creating a PaymentMethod instance from None.""" payment_method = PaymentMethod.from_dict(None) assert payment_method is None diff --git a/tests/multisafepay/unit/client/test_unit_api_key.py b/tests/multisafepay/unit/client/test_unit_api_key.py index 62bac53..0183791 100644 --- a/tests/multisafepay/unit/client/test_unit_api_key.py +++ b/tests/multisafepay/unit/client/test_unit_api_key.py @@ -16,45 +16,30 @@ def test_valid_api_key_initialization(): - """ - Test the initialization of a valid API key. - - """ + """Test the initialization of a valid API key.""" api_key = ApiKey(api_key="valid_api_key") assert api_key.api_key == "valid_api_key" def test_invalid_api_key_initialization(): - """ - Test raising InvalidApiKeyException for an invalid API key. - - """ + """Test raising InvalidApiKeyException for an invalid API key.""" with pytest.raises(InvalidApiKeyException, match="Invalid API key"): ApiKey() def test_invalid_api_key_initialization_none(): - """ - Test raising InvalidApiKeyException for an invalid API key. - - """ + """Test raising InvalidApiKeyException for an invalid API key.""" with pytest.raises(ValidationError): ApiKey(api_key=None) def test_invalid_api_key_initialization(): - """ - Test raising InvalidApiKeyException for an invalid API key. - - """ + """Test raising InvalidApiKeyException for an invalid API key.""" with pytest.raises(InvalidApiKeyException, match="Invalid API key"): ApiKey(api_key="1234") def test_api_key_retrieval(): - """ - Test the retrieval of a valid API key. - - """ + """Test the retrieval of a valid API key.""" api_key = ApiKey(api_key="another_valid_key") assert api_key.get() == "another_valid_key" diff --git a/tests/multisafepay/unit/client/test_unit_client.py b/tests/multisafepay/unit/client/test_unit_client.py index 2aba41b..5575186 100644 --- a/tests/multisafepay/unit/client/test_unit_client.py +++ b/tests/multisafepay/unit/client/test_unit_client.py @@ -14,19 +14,13 @@ def test_initializes_with_default_http_client(): - """ - Test that the Client initializes with the default HTTP client. - - """ + """Test that the Client initializes with the default HTTP client.""" client = Client(api_key="mock_api_key", is_production=False) assert isinstance(client.http_client, Session) def test_initializes_with_custom_http_client(): - """ - Test that the Client initializes with a custom HTTP client. - - """ + """Test that the Client initializes with a custom HTTP client.""" custom_http_client = Mock() client = Client( api_key="mock_api_key", diff --git a/tests/multisafepay/unit/exception/test_unit_api.py b/tests/multisafepay/unit/exception/test_unit_api.py index 326211d..60fddfb 100644 --- a/tests/multisafepay/unit/exception/test_unit_api.py +++ b/tests/multisafepay/unit/exception/test_unit_api.py @@ -13,30 +13,21 @@ def test_api_exception_initialization(): - """ - Test the initialization of ApiException. - - """ + """Test the initialization of ApiException.""" exception = ApiException("An error occurred") assert str(exception) == "An error occurred" assert exception.context == {} def test_api_exception_initialization__string__(): - """ - Test the initialization of ApiException with a string representation. - - """ + """Test the initialization of ApiException with a string representation.""" context = {"key": "value"} exception = ApiException("An error occurred", context) assert str(exception) == "('An error occurred', {'key': 'value'})" def test_api_exception_initialization_with_context(): - """ - Test the initialization of ApiException with context. - - """ + """Test the initialization of ApiException with context.""" context = {"key": "value"} exception = ApiException("An error occurred", context) assert exception.get_message() == "An error occurred" @@ -44,20 +35,14 @@ def test_api_exception_initialization_with_context(): def test_add_context(): - """ - Test adding context to ApiException. - - """ + """Test adding context to ApiException.""" exception = ApiException("An error occurred") exception.add_context({"key": "value"}) assert exception.context == {"key": "value"} def test_get_details(): - """ - Test getting details from ApiException. - - """ + """Test getting details from ApiException.""" context = {"key": "value"} exception = ApiException("An error occurred", context) details = exception.get_details() @@ -66,10 +51,7 @@ def test_get_details(): def test_get_context_as_array(): - """ - Test getting context as an array from ApiException. - - """ + """Test getting context as an array from ApiException.""" context = {"key": "value"} exception = ApiException("An error occurred", context) context_array = exception.get_context_as_array() @@ -78,10 +60,7 @@ def test_get_context_as_array(): def test_get_context_value(): - """ - Test getting a specific context value from ApiException. - - """ + """Test getting a specific context value from ApiException.""" context = {"key": "value"} exception = ApiException("An error occurred", context) assert exception.get_context_value("key") == "value" diff --git a/tests/multisafepay/unit/exception/test_unit_api_available.py b/tests/multisafepay/unit/exception/test_unit_api_available.py index 9caa107..aeffebc 100644 --- a/tests/multisafepay/unit/exception/test_unit_api_available.py +++ b/tests/multisafepay/unit/exception/test_unit_api_available.py @@ -14,17 +14,11 @@ def test_api_unavailable_exception_is_subclass(): - """ - Test if ApiUnavailableException is a subclass of ApiException. - - """ + """Test if ApiUnavailableException is a subclass of ApiException.""" assert issubclass(ApiUnavailableException, ApiException) def test_raise_api_unavailable_exception(): - """ - Test raising ApiUnavailableException. - - """ + """Test raising ApiUnavailableException.""" with pytest.raises(ApiUnavailableException): raise ApiUnavailableException("API is unavailable") diff --git a/tests/multisafepay/unit/exception/test_unit_invalid_api_key.py b/tests/multisafepay/unit/exception/test_unit_invalid_api_key.py index 90c2ef9..9380c70 100644 --- a/tests/multisafepay/unit/exception/test_unit_invalid_api_key.py +++ b/tests/multisafepay/unit/exception/test_unit_invalid_api_key.py @@ -13,17 +13,11 @@ def test_invalid_api_key_exception_is_subclass(): - """ - Test if InvalidApiKeyException is a subclass of Exception. - - """ + """Test if InvalidApiKeyException is a subclass of Exception.""" assert issubclass(InvalidApiKeyException, Exception) def test_raise_invalid_api_key_exception(): - """ - Test raising InvalidApiKeyException. - - """ + """Test raising InvalidApiKeyException.""" with pytest.raises(InvalidApiKeyException): raise InvalidApiKeyException("Invalid API key provided") diff --git a/tests/multisafepay/unit/exception/test_unit_invalid_argument.py b/tests/multisafepay/unit/exception/test_unit_invalid_argument.py index f5f42c6..6714cef 100644 --- a/tests/multisafepay/unit/exception/test_unit_invalid_argument.py +++ b/tests/multisafepay/unit/exception/test_unit_invalid_argument.py @@ -13,9 +13,6 @@ def test_invalid_argument_exception(): - """ - Test raising InvalidArgumentException. - - """ + """Test raising InvalidArgumentException.""" with pytest.raises(InvalidArgumentException): raise InvalidArgumentException("Invalid argument") diff --git a/tests/multisafepay/unit/exception/test_unit_invalid_total_amount.py b/tests/multisafepay/unit/exception/test_unit_invalid_total_amount.py index e17f968..c6b5d37 100644 --- a/tests/multisafepay/unit/exception/test_unit_invalid_total_amount.py +++ b/tests/multisafepay/unit/exception/test_unit_invalid_total_amount.py @@ -15,9 +15,6 @@ def test_invalid_total_amount_exception(): - """ - Test raising InvalidTotalAmountException. - - """ + """Test raising InvalidTotalAmountException.""" with pytest.raises(InvalidTotalAmountException): raise InvalidTotalAmountException("Invalid total amount") diff --git a/tests/multisafepay/unit/exception/test_unit_missing_plugin_version.py b/tests/multisafepay/unit/exception/test_unit_missing_plugin_version.py index 2edfa05..d11ea2b 100644 --- a/tests/multisafepay/unit/exception/test_unit_missing_plugin_version.py +++ b/tests/multisafepay/unit/exception/test_unit_missing_plugin_version.py @@ -16,17 +16,11 @@ def test_missing_plugin_version_exception_is_subclass(): - """ - Test if MissingPluginVersionException is a subclass of InvalidArgumentException. - - """ + """Test if MissingPluginVersionException is a subclass of InvalidArgumentException.""" assert issubclass(MissingPluginVersionException, InvalidArgumentException) def test_raise_missing_plugin_version_exception(): - """ - Test raising MissingPluginVersionException. - - """ + """Test raising MissingPluginVersionException.""" with pytest.raises(MissingPluginVersionException): raise MissingPluginVersionException("Missing plugin version") diff --git a/tests/multisafepay/unit/util/test_unit_dict_utils.py b/tests/multisafepay/unit/util/test_unit_dict_utils.py index 78fc0b5..6e83627 100644 --- a/tests/multisafepay/unit/util/test_unit_dict_utils.py +++ b/tests/multisafepay/unit/util/test_unit_dict_utils.py @@ -17,10 +17,7 @@ def test_merge_recursive_with_non_overlapping_keys(): - """ - Test merging two dictionaries with non-overlapping keys. - - """ + """Test merging two dictionaries with non-overlapping keys.""" dict1 = {"a": 1, "b": 2} dict2 = {"c": 3, "d": 4} result = merge_recursive(dict1, dict2) @@ -28,11 +25,7 @@ def test_merge_recursive_with_non_overlapping_keys(): def test_merge_recursive_with_overlapping_keys(): - """ - Test merging two dictionaries with overlapping keys. - - - """ + """Test merging two dictionaries with overlapping keys.""" dict1 = {"a": 1, "b": {"x": 10}} dict2 = {"b": {"y": 20}, "c": 3} result = merge_recursive(dict1, dict2) @@ -40,10 +33,7 @@ def test_merge_recursive_with_overlapping_keys(): def test_merge_recursive_with_empty_dict1(): - """ - Test merging an empty dictionary with a non-empty dictionary. - - """ + """Test merging an empty dictionary with a non-empty dictionary.""" dict1 = {} dict2 = {"a": 1, "b": 2} result = merge_recursive(dict1, dict2) @@ -51,11 +41,7 @@ def test_merge_recursive_with_empty_dict1(): def test_merge_recursive_with_empty_dict2(): - """ - Test merging a non-empty dictionary with an empty dictionary. - - - """ + """Test merging a non-empty dictionary with an empty dictionary.""" dict1 = {"a": 1, "b": 2} dict2 = {} result = merge_recursive(dict1, dict2) @@ -63,102 +49,70 @@ def test_merge_recursive_with_empty_dict2(): def test_remove_null_with_no_null_values(): - """ - Test removing null values from a dictionary with no null values. - - """ + """Test removing null values from a dictionary with no null values.""" data = {"a": 1, "b": 2, "c": 3} result = remove_null(data) assert result == {"a": 1, "b": 2, "c": 3} def test_remove_null_with_some_null_values(): - """ - Test removing null values from a dictionary with some null values. - - - """ + """Test removing null values from a dictionary with some null values.""" data = {"a": 1, "b": None, "c": 3} result = remove_null(data) assert result == {"a": 1, "c": 3} def test_remove_null_with_all_null_values(): - """ - Test removing null values from a dictionary with all null values. - - """ + """Test removing null values from a dictionary with all null values.""" data = {"a": None, "b": None} result = remove_null(data) assert result == {} def test_remove_null_with_empty_dict(): - """ - Test removing null values from an empty dictionary. - - """ + """Test removing null values from an empty dictionary.""" data = {} result = remove_null(data) assert result == {} def test_remove_null_recursive_with_no_null_values(): - """ - Test removing null values from a dictionary with no null values. - - - """ + """Test removing null values from a dictionary with no null values.""" data = {"a": 1, "b": 2, "c": 3} result = remove_null_recursive(data) assert result == {"a": 1, "b": 2, "c": 3} def test_remove_null_recursive_with_some_null_values(): - """ - Test removing null values from a dictionary with some null values. - - """ + """Test removing null values from a dictionary with some null values.""" data = {"a": 1, "b": None, "c": 3} result = remove_null_recursive(data) assert result == {"a": 1, "c": 3} def test_remove_null_recursive_with_nested_null_values(): - """ - Test removing null values from a dictionary with nested null values. - - """ + """Test removing null values from a dictionary with nested null values.""" data = {"a": 1, "b": {"x": 10, "y": None}} result = remove_null_recursive(data) assert result == {"a": 1, "b": {"x": 10}} def test_remove_null_recursive_with_empty_list(): - """ - Test removing null values from a dictionary with an empty list. - - """ + """Test removing null values from a dictionary with an empty list.""" data = {"a": 1, "b": []} result = remove_null_recursive(data) assert result == {"a": 1, "b": []} def test_remove_null_recursive_with_list_of_dicts(): - """ - Test removing null values from a dictionary with a list of dictionaries. - - """ + """Test removing null values from a dictionary with a list of dictionaries.""" data = {"a": 1, "b": [{"x": 10, "y": None}, {"z": None}]} result = remove_null_recursive(data) assert result == {"a": 1, "b": [{"x": 10}]} def test_remove_null_recursive_multiple_nested_levels_dicts_and_lists(): - """ - Test removing null values from a dictionary with multiple nested levels of dictionaries and lists. - - """ + """Test removing null values from a dictionary with multiple nested levels of dictionaries and lists.""" data = { "a": 1, "b": { @@ -175,10 +129,6 @@ def test_remove_null_recursive_multiple_nested_levels_dicts_and_lists(): def test_dict_empty(): - """ - Test checking if a dictionary or list is empty. - - - """ + """Test checking if a dictionary or list is empty.""" assert dict_empty({}) == True assert dict_empty({"a": 1}) == False diff --git a/tests/multisafepay/unit/util/test_unit_message.py b/tests/multisafepay/unit/util/test_unit_message.py index 6b25bb8..354c3c0 100644 --- a/tests/multisafepay/unit/util/test_unit_message.py +++ b/tests/multisafepay/unit/util/test_unit_message.py @@ -14,50 +14,30 @@ def test_message_initialization(): - """ - Test the initialization of a Message object with a specific message content. - - - """ + """Test the initialization of a Message object with a specific message content.""" message = Message(message="test message") assert message.message == "test message" def test_message_deserialization(): - """ - Test the deserialization of a Message object to a dictionary. - - - """ + """Test the deserialization of a Message object to a dictionary.""" message = Message(message="test message") assert message.dict() == {"message": "test message"} def test_empty_message_initialization(): - """ - Test the initialization of a Message object without providing any message content. - - - """ + """Test the initialization of a Message object without providing any message content.""" with pytest.raises(ValueError): Message() def test_message_list_initialization(): - """ - Test the initialization of a MessageList object. - - - """ + """Test the initialization of a MessageList object.""" assert MessageList() == MessageList(__root__=[]) def test_message_list_get_message(): - """ - Test the get method of the MessageList object. - - - """ + """Test the get method of the MessageList object.""" message_list = MessageList() message_list.add_message("example") assert message_list.get_messages() == [{"message": "example"}] diff --git a/tests/multisafepay/unit/util/test_unit_total_amount.py b/tests/multisafepay/unit/util/test_unit_total_amount.py index 56af838..a8e572c 100644 --- a/tests/multisafepay/unit/util/test_unit_total_amount.py +++ b/tests/multisafepay/unit/util/test_unit_total_amount.py @@ -16,10 +16,7 @@ def test_get_tax_rate_by_item(): - """ - Test the get_tax_rate_by_item method. - - """ + """Test the get_tax_rate_by_item method.""" item = {"unit_price": 1000, "quantity": 1, "tax_table_selector": "BTW10"} data = { @@ -41,11 +38,7 @@ def test_get_tax_rate_by_item(): def test_get_tax_rate_by_item_btw21(): - """ - Test the get_tax_rate_by_item method. - - - """ + """Test the get_tax_rate_by_item method.""" item = {"unit_price": 1000, "quantity": 1, "tax_table_selector": "BTW22"} data = { @@ -67,10 +60,7 @@ def test_get_tax_rate_by_item_btw21(): def test_calculate_totals(): - """ - Test the calculate_totals method. - - """ + """Test the calculate_totals method.""" data = { "shopping_cart": { "items": [ @@ -87,10 +77,7 @@ def test_calculate_totals(): def test_validate_total_amount(): - """ - Test the validate_total_amount method. - - """ + """Test the validate_total_amount method.""" data = { "amount": 1000, "shopping_cart": { diff --git a/tests/multisafepay/unit/util/test_unit_version.py b/tests/multisafepay/unit/util/test_unit_version.py index eadca53..a88ed34 100644 --- a/tests/multisafepay/unit/util/test_unit_version.py +++ b/tests/multisafepay/unit/util/test_unit_version.py @@ -13,88 +13,55 @@ def test_version_initialization(): - """ - Test the initialization of a Version object with specific plugin and SDK versions. - - - """ + """Test the initialization of a Version object with specific plugin and SDK versions.""" version = Version(plugin_version="1.0.1") assert version.plugin_version == "1.0.1" def test_version_deserialization(): - """ - Test the deserialization of a Version object to a dictionary. - - - """ + """Test the deserialization of a Version object to a dictionary.""" version = Version(plugin_version="1.0.1") assert version.dict() == {"plugin_version": "1.0.1"} def test_version_serialization(): - """ - Test the serialization of a Version object to a JSON string. - - - """ + """Test the serialization of a Version object to a JSON string.""" version = Version(plugin_version="1.0.1") assert version.json() == '{"plugin_version": "1.0.1"}' def test_empty_version_initialization(): - """ - Test the initialization of a Version object without providing any version values. - - - """ + """Test the initialization of a Version object without providing any version values.""" version = Version() assert version.plugin_version == "unknown" def test_empty_version_deserialization(): - """ - Test the deserialization of an empty Version object to a dictionary. - - """ + """Test the deserialization of an empty Version object to a dictionary.""" version = Version() assert version.dict() == {"plugin_version": "unknown"} def test_empty_version_serialization(): - """ - Test the serialization of an empty Version object to a JSON string. - - """ + """Test the serialization of an empty Version object to a JSON string.""" version = Version() assert version.json() == '{"plugin_version": "unknown"}' def test_version_get_plugin_version(): - """ - Test the get_plugin_version method of the Version object. - - - """ + """Test the get_plugin_version method of the Version object.""" version = Version(plugin_version="1.0.1") assert version.get_plugin_version() == "1.0.1" def test_version_get_version(): - """ - Test the get_version method of the Version object. - - """ + """Test the get_version method of the Version object.""" version = Version(plugin_version="1.0.1") assert version.get_version() == "Plugin 1.0.1" def test_version_set_plugin_version(): - """ - Test the set_plugin_version method of the Version object. - - - """ + """Test the set_plugin_version method of the Version object.""" version = Version() version.set_plugin_version("1.0.1") assert version.plugin_version == "1.0.1" diff --git a/tests/multisafepay/unit/util/test_unit_webhook.py b/tests/multisafepay/unit/util/test_unit_webhook.py index 064ee05..95e4eaa 100644 --- a/tests/multisafepay/unit/util/test_unit_webhook.py +++ b/tests/multisafepay/unit/util/test_unit_webhook.py @@ -119,30 +119,22 @@ def test_check_auth_with_no_timestamp_check(): - """ - Test that the Webhook.validate method returns True when the timestamp check is disabled. - """ + """Test that the Webhook.validate method returns True when the timestamp check is disabled.""" assert Webhook.validate(JSON_STRING, AUTH, API_KEY, 0) def test_check_auth_with_failing_timestamp_check(): - """ - Test that the Webhook.validate method returns False when the timestamp check fails. - """ + """Test that the Webhook.validate method returns False when the timestamp check fails.""" assert not Webhook.validate(JSON_STRING, AUTH, API_KEY, 1) def test_verify_with_invalid_api_key(): - """ - Test that the Webhook.validate method returns False when an invalid API key is provided. - """ + """Test that the Webhook.validate method returns False when an invalid API key is provided.""" assert not Webhook.validate(JSON_STRING, AUTH, "a-fake-API-key", 0) def test_verify_with_invalid_json_argument(): - """ - Test that the Webhook.validate method raises an InvalidArgumentException when an invalid JSON argument is provided. - """ + """Test that the Webhook.validate method raises an InvalidArgumentException when an invalid JSON argument is provided.""" with pytest.raises( InvalidArgumentException, ): # changed to TypeError because in python you cant pass int to json.loads @@ -150,9 +142,7 @@ def test_verify_with_invalid_json_argument(): def test_verify_with_invalid_validation_time_argument(): - """ - Test that the Webhook.validate method raises an InvalidArgumentException when an invalid validation time argument is provided. - """ + """Test that the Webhook.validate method raises an InvalidArgumentException when an invalid validation time argument is provided.""" with pytest.raises( InvalidArgumentException, ): # changed to ValueError to match python's error handling. @@ -160,9 +150,7 @@ def test_verify_with_invalid_validation_time_argument(): def test_verify_with_empty_spaces_in_api_key(): - """ - Test that the Webhook.validate method returns True when the API key contains leading or trailing spaces. - """ + """Test that the Webhook.validate method returns True when the API key contains leading or trailing spaces.""" assert Webhook.validate( JSON_STRING, AUTH, diff --git a/tests/multisafepay/unit/value_object/creditcard/test_unit_cvc.py b/tests/multisafepay/unit/value_object/creditcard/test_unit_cvc.py index 789df46..fb1b252 100644 --- a/tests/multisafepay/unit/value_object/creditcard/test_unit_cvc.py +++ b/tests/multisafepay/unit/value_object/creditcard/test_unit_cvc.py @@ -15,55 +15,36 @@ def test_amount_initialization(): - """ - Test the initialization of an Amount object with a valid amount value. - - """ + """Test the initialization of an Amount object with a valid amount value.""" amount = Amount(amount=100) assert amount.amount == 100 def test_empty_amount_initialization(): - """ - Test the initialization of an Amount object without providing an amount value. - - - """ + """Test the initialization of an Amount object without providing an amount value.""" with pytest.raises(ValidationError): Amount() def test_cast_initialization_valid(): - """ - Test the initialization of an Amount object with a valid amount value as a string. - - """ + """Test the initialization of an Amount object with a valid amount value as a string.""" amount = Amount(amount="100") assert amount.amount == 100 def test_amount_initialization_zero(): - """ - Test the initialization of an Amount object with a zero amount value. - - """ + """Test the initialization of an Amount object with a zero amount value.""" amount = Amount(amount=0) assert amount.amount == 0 def test_amount_initialization_negative(): - """ - Test the initialization of an Amount object with a negative amount value. - - """ + """Test the initialization of an Amount object with a negative amount value.""" amount = Amount(amount=-50) assert amount.amount == -50 def test_amount_get(): - """ - Test the get method of the Amount object. - - """ + """Test the get method of the Amount object.""" amount = Amount(amount=100) assert amount.get() == 100 diff --git a/tests/multisafepay/unit/value_object/test_unit_amount.py b/tests/multisafepay/unit/value_object/test_unit_amount.py index 3dd7f7f..538ba74 100644 --- a/tests/multisafepay/unit/value_object/test_unit_amount.py +++ b/tests/multisafepay/unit/value_object/test_unit_amount.py @@ -15,55 +15,36 @@ def test_amount_initialization(): - """ - Test the initialization of an Amount object with a valid amount value. - - """ + """Test the initialization of an Amount object with a valid amount value.""" amount = Amount(amount=100) assert amount.amount == 100 def test_empty_amount_initialization(): - """ - Test the initialization of an Amount object without providing an amount value. - - """ + """Test the initialization of an Amount object without providing an amount value.""" with pytest.raises(ValidationError): Amount() def test_cast_initialization_valid(): - """ - Test the initialization of an Amount object with a valid amount value as a string. - - """ + """Test the initialization of an Amount object with a valid amount value as a string.""" amount = Amount(amount="100") assert amount.amount == 100 def test_amount_initialization_zero(): - """ - Test the initialization of an Amount object with a zero amount value. - - """ + """Test the initialization of an Amount object with a zero amount value.""" amount = Amount(amount=0) assert amount.amount == 0 def test_amount_initialization_negative(): - """ - Test the initialization of an Amount object with a negative amount value. - - - """ + """Test the initialization of an Amount object with a negative amount value.""" amount = Amount(amount=-50) assert amount.amount == -50 def test_amount_get(): - """ - Test the get method of the Amount object. - - """ + """Test the get method of the Amount object.""" amount = Amount(amount=100) assert amount.get() == 100 diff --git a/tests/multisafepay/unit/value_object/test_unit_bank_account.py b/tests/multisafepay/unit/value_object/test_unit_bank_account.py index f978d8f..2e0d311 100644 --- a/tests/multisafepay/unit/value_object/test_unit_bank_account.py +++ b/tests/multisafepay/unit/value_object/test_unit_bank_account.py @@ -13,39 +13,24 @@ def test_bank_account_initialization(): - """ - Test the initialization of a BankAccount object with a valid bank account number. - - """ + """Test the initialization of a BankAccount object with a valid bank account number.""" bank_account = BankAccount(bank_account="NL91ABNA0417164300") assert bank_account.bank_account == "NL91ABNA0417164300" def test_bank_account_initialization_invalid_no_validation(): - """ - Test the initialization of a BankAccount object with an invalid bank account number. - - - """ + """Test the initialization of a BankAccount object with an invalid bank account number.""" bank_account = BankAccount(bank_account="INVALID_ACCOUNT") assert bank_account.bank_account == "INVALID_ACCOUNT" def test_bank_account_initialization_is_not_string(): - """ - Test the initialization of a BankAccount object with a non-string bank account number. - - - """ + """Test the initialization of a BankAccount object with a non-string bank account number.""" with pytest.raises(ValueError): BankAccount(bank_account=None) def test_bank_account_get(): - """ - Test the get method of the BankAccount object. - - - """ + """Test the get method of the BankAccount object.""" bank_account = BankAccount(bank_account="NL91ABNA0417164300") assert bank_account.get() == "NL91ABNA0417164300" diff --git a/tests/multisafepay/unit/value_object/test_unit_country.py b/tests/multisafepay/unit/value_object/test_unit_country.py index af906d7..07416e7 100644 --- a/tests/multisafepay/unit/value_object/test_unit_country.py +++ b/tests/multisafepay/unit/value_object/test_unit_country.py @@ -16,46 +16,30 @@ def test_country_initialization_with_valid_code(): - """ - Test the initialization of a Country object with a valid country code. - - """ + """Test the initialization of a Country object with a valid country code.""" country = Country(code="US") assert country.code == "US" def test_country_initialization_with_invalid_code_length(): - """ - Test the initialization of a Country object with an invalid country code length. - - """ + """Test the initialization of a Country object with an invalid country code length.""" with pytest.raises(InvalidArgumentException): Country(code="USA") def test_country_initialization_with_empty_code(): - """ - Test the initialization of a Country object with an empty country code. - - """ + """Test the initialization of a Country object with an empty country code.""" with pytest.raises(ValidationError): Country() def test_country_initialization_with_lowercase_code(): - """ - Test the initialization of a Country object with a lowercase country code. - - - """ + """Test the initialization of a Country object with a lowercase country code.""" country = Country(code="nl") assert country.get_code() == "NL" def test_country_initialization_with_uppercase_code(): - """ - Test the initialization of a Country object with an uppercase country code. - - """ + """Test the initialization of a Country object with an uppercase country code.""" country = Country(code="DE") assert country.get_code() == "DE" diff --git a/tests/multisafepay/unit/value_object/test_unit_currency.py b/tests/multisafepay/unit/value_object/test_unit_currency.py index 8d675e4..e07307b 100644 --- a/tests/multisafepay/unit/value_object/test_unit_currency.py +++ b/tests/multisafepay/unit/value_object/test_unit_currency.py @@ -14,20 +14,13 @@ def test_currency_initialization(): - """ - Test the initialization of a Currency object with a valid currency code. - - """ + """Test the initialization of a Currency object with a valid currency code.""" currency = Currency(currency="USD") assert currency.currency == "USD" def test_currency_is_not_string(): - """ - Test the initialization of a Currency object with a non-string currency code. - - - """ + """Test the initialization of a Currency object with a non-string currency code.""" with pytest.raises( InvalidArgumentException, match='Value "0" is not a valid currency code', @@ -36,9 +29,6 @@ def test_currency_is_not_string(): def test_currency_get(): - """ - Test the get method of the Currency object. - - """ + """Test the get method of the Currency object.""" currency = Currency(currency="USD") assert currency.get() == "USD" diff --git a/tests/multisafepay/unit/value_object/test_unit_date.py b/tests/multisafepay/unit/value_object/test_unit_date.py index 6060c92..f3f4627 100644 --- a/tests/multisafepay/unit/value_object/test_unit_date.py +++ b/tests/multisafepay/unit/value_object/test_unit_date.py @@ -16,10 +16,7 @@ def test_date_initialization(): - """ - Test the initialization of a Date object with a valid date string. - - """ + """Test the initialization of a Date object with a valid date string.""" date_str = "2023-10-10" date = Date(date=date_str) assert date.str_date == date_str @@ -29,21 +26,13 @@ def test_date_initialization(): def test_date_initialization_is_not_string(): - """ - Test the initialization of a Date object with a non-string date. - - - """ + """Test the initialization of a Date object with a non-string date.""" with pytest.raises(TypeError): Date() def test_date_initialization_no_format(): - """ - Test the initialization of a Date object with an invalid date string. - - - """ + """Test the initialization of a Date object with an invalid date string.""" with pytest.raises( InvalidArgumentException, match='Value "invalid-date" is an invalid date format', @@ -52,11 +41,7 @@ def test_date_initialization_no_format(): def test_date_initialization_invalid_format(): - """ - Test the initialization of a Date object with a date string in an invalid format. - - - """ + """Test the initialization of a Date object with a date string in an invalid format.""" with pytest.raises( InvalidArgumentException, match='Value "10-10-2023" is an invalid date format', @@ -65,43 +50,28 @@ def test_date_initialization_invalid_format(): def test_date_get_default_format(): - """ - Test the get method of the Date object with the default format. - - """ + """Test the get method of the Date object with the default format.""" date_str = "2023-10-10" date_obj = Date(date_str) assert date_obj.get() == date_str def test_date_get_custom_format(): - """ - Test the get method of the Date object with a custom format. - - - """ + """Test the get method of the Date object with a custom format.""" date_str = "2023-10-10" date_obj = Date(date_str) assert date_obj.get("%d-%m-%Y") == "10-10-2023" def test_date_get_custom_format_2(): - """ - Test the get method of the Date object with another custom format. - - - """ + """Test the get method of the Date object with another custom format.""" date_str = "2023-10-10" date_obj = Date(date_str) assert date_obj.get("%Y/%m/%d") == "2023/10/10" def test_date_get_custom_format_3(): - """ - Test the get method of the Date object with a custom format for a date-time string. - - - """ + """Test the get method of the Date object with a custom format for a date-time string.""" date_str = "2025-03-02T00:34:46" date_obj = Date(date_str) assert date_obj.get("%Y-%m-%d") == "2025-03-02" diff --git a/tests/multisafepay/unit/value_object/test_unit_email_address.py b/tests/multisafepay/unit/value_object/test_unit_email_address.py index 48dda99..ab09a2e 100644 --- a/tests/multisafepay/unit/value_object/test_unit_email_address.py +++ b/tests/multisafepay/unit/value_object/test_unit_email_address.py @@ -16,47 +16,31 @@ def test_email_address_initialization(): - """ - Test the initialization of an EmailAddress object with a valid email address. - - """ + """Test the initialization of an EmailAddress object with a valid email address.""" email_address = EmailAddress(email_address="test@example.com") assert email_address.email_address == "test@example.com" def test_email_address_initialization_with_invalid_email(): - """ - Test the initialization of an EmailAddress object with an invalid email address. - - """ + """Test the initialization of an EmailAddress object with an invalid email address.""" with pytest.raises(InvalidArgumentException): EmailAddress(email_address="invalid-email") def test_email_address_initialization_is_not_string(): - """ - Test the initialization of an EmailAddress object with a non-string email address. - - """ + """Test the initialization of an EmailAddress object with a non-string email address.""" with pytest.raises(ValidationError): EmailAddress(email_address=None) def test_email_address_get(): - """ - Test the get method of the EmailAddress object. - - - """ + """Test the get method of the EmailAddress object.""" email_address = EmailAddress(email_address="user@domain.com") assert email_address.get() == "user@domain.com" def test_is_valid_email(): - """ - Test the is_valid_email method of the EmailAddress class. - - """ + """Test the is_valid_email method of the EmailAddress class.""" assert EmailAddress.is_valid_email("valid.email@example.com") assert not EmailAddress.is_valid_email("invalid-email") assert not EmailAddress.is_valid_email("invalid@domain") diff --git a/tests/multisafepay/unit/value_object/test_unit_gender.py b/tests/multisafepay/unit/value_object/test_unit_gender.py index 880e890..d4d9bdc 100644 --- a/tests/multisafepay/unit/value_object/test_unit_gender.py +++ b/tests/multisafepay/unit/value_object/test_unit_gender.py @@ -16,46 +16,30 @@ def test_gender_initialization_valid(): - """ - Test the initialization of a Gender object with a valid gender. - - """ + """Test the initialization of a Gender object with a valid gender.""" gender = Gender(gender="male") assert gender.gender == "male" def test_gender_is_not_string(): - """ - Test the initialization of a Gender object with a non-string gender. - - """ + """Test the initialization of a Gender object with a non-string gender.""" with pytest.raises(ValidationError): Gender() def test_unknown_gender(): - """ - Test the initialization of a Gender object with an unknown gender. - - """ + """Test the initialization of a Gender object with an unknown gender.""" with pytest.raises(InvalidArgumentException): Gender(gender="123") def test_gender_get(): - """ - Test the get method of the Gender object. - - - """ + """Test the get method of the Gender object.""" gender = Gender(gender="mr") assert gender.get() == "mr" def test_gender_initialization_invalid(): - """ - Test the initialization of a Gender object with an invalid gender. - - """ + """Test the initialization of a Gender object with an invalid gender.""" with pytest.raises(InvalidArgumentException): Gender(gender="unknown") diff --git a/tests/multisafepay/unit/value_object/test_unit_iban_number.py b/tests/multisafepay/unit/value_object/test_unit_iban_number.py index 3f8a146..ae133ea 100644 --- a/tests/multisafepay/unit/value_object/test_unit_iban_number.py +++ b/tests/multisafepay/unit/value_object/test_unit_iban_number.py @@ -16,29 +16,19 @@ def test_iban_number_initialization_valid(): - """ - Test the initialization of an IbanNumber object with a valid IBAN number. - - - """ + """Test the initialization of an IbanNumber object with a valid IBAN number.""" iban_number = IbanNumber(iban_number="DE89370400440532013000") assert iban_number.iban_number == "DE89370400440532013000" def test_empty_iban_number_initialization(): - """ - Test the initialization of an IbanNumber object with no IBAN number. - - """ + """Test the initialization of an IbanNumber object with no IBAN number.""" with pytest.raises(ValidationError): IbanNumber() def test_iban_number_invalid_argument(): - """ - Test the initialization of an IbanNumber object with an invalid IBAN number. - - """ + """Test the initialization of an IbanNumber object with an invalid IBAN number.""" with pytest.raises( InvalidArgumentException, match='Value "INVALIDIBAN" is not a valid IBAN number', @@ -47,27 +37,18 @@ def test_iban_number_invalid_argument(): def test_iban_number_get(): - """ - Test the get method of the IbanNumber object. - - """ + """Test the get method of the IbanNumber object.""" iban = IbanNumber(iban_number="DE89370400440532013000") assert iban.get() == "DE89370400440532013000" def test_validate_iban_number_valid(): - """ - Test the validate_iban_number method with a valid IBAN number. - - """ + """Test the validate_iban_number method with a valid IBAN number.""" assert IbanNumber.validate_iban_number("DE89370400440532013000") is True def test_validate_iban_number_invalid_length(): - """ - Test the validate_iban_number method with an IBAN number of invalid length. - - """ + """Test the validate_iban_number method with an IBAN number of invalid length.""" with pytest.raises( InvalidArgumentException, match='Value "DE89" is not a valid IBAN number', @@ -76,10 +57,7 @@ def test_validate_iban_number_invalid_length(): def test_validate_iban_number_invalid_format(): - """ - Test the validate_iban_number method with an IBAN number of invalid format. - - """ + """Test the validate_iban_number method with an IBAN number of invalid format.""" with pytest.raises( InvalidArgumentException, match='Value "INVALIDIBAN" is not a valid IBAN number', diff --git a/tests/multisafepay/unit/value_object/test_unit_ip_address.py b/tests/multisafepay/unit/value_object/test_unit_ip_address.py index 73b0e20..69df9c7 100644 --- a/tests/multisafepay/unit/value_object/test_unit_ip_address.py +++ b/tests/multisafepay/unit/value_object/test_unit_ip_address.py @@ -16,46 +16,31 @@ def test_ip_address_initialization(): - """ - Test the initialization of an IpAddress object with a valid IPv4 address. - - """ + """Test the initialization of an IpAddress object with a valid IPv4 address.""" ip = IpAddress(ip_address="192.168.1.1") assert ip.ip_address == "192.168.1.1" def test_empty_ip_address_initialization(): - """ - Test the initialization of an IpAddress object with no IP address. - - """ + """Test the initialization of an IpAddress object with no IP address.""" with pytest.raises(ValidationError): IpAddress() def test_invalid_ip_address_initialization(): - """ - Test the initialization of an IpAddress object with an invalid IP address (None). - - """ + """Test the initialization of an IpAddress object with an invalid IP address (None).""" with pytest.raises(ValidationError): IpAddress(ip_address=None) def test_ip_address_initialization_ipv6(): - """ - Test the initialization of an IpAddress object with a valid IPv6 address. - - """ + """Test the initialization of an IpAddress object with a valid IPv6 address.""" ip = IpAddress(ip_address="2001:0db8:85a3:0000:0000:8a2e:0370:7334") assert ip.get() == "2001:0db8:85a3:0000:0000:8a2e:0370:7334" def test_ip_address_initialization_invalid_ip(): - """ - Test the initialization of an IpAddress object with an invalid IP address. - - """ + """Test the initialization of an IpAddress object with an invalid IP address.""" with pytest.raises( InvalidArgumentException, match='Value "invalid_ip" is not a valid IP address', @@ -64,19 +49,12 @@ def test_ip_address_initialization_invalid_ip(): def test_ip_address_initialization_comma_separated_ips(): - """ - Test the initialization of an IpAddress object with a comma-separated list of IP addresses. - - """ + """Test the initialization of an IpAddress object with a comma-separated list of IP addresses.""" ip = IpAddress(ip_address="192.168.1.1, 10.0.0.1") assert ip.get() == "192.168.1.1" def test_ip_address_get(): - """ - Test the get method of the IpAddress object. - - - """ + """Test the get method of the IpAddress object.""" ip = IpAddress(ip_address="192.168.1.1") assert ip.get() == "192.168.1.1" diff --git a/tests/multisafepay/unit/value_object/test_unit_phone_number.py b/tests/multisafepay/unit/value_object/test_unit_phone_number.py index f92390a..7ce4722 100644 --- a/tests/multisafepay/unit/value_object/test_unit_phone_number.py +++ b/tests/multisafepay/unit/value_object/test_unit_phone_number.py @@ -15,11 +15,7 @@ def test_phone_number_initialization(): - """ - Test the initialization of a PhoneNumber object with a valid phone number. - - - """ + """Test the initialization of a PhoneNumber object with a valid phone number.""" phone_number = PhoneNumber(phone_number="1234567890") assert phone_number.phone_number == "1234567890" diff --git a/tests/multisafepay/unit/value_object/test_unit_price.py b/tests/multisafepay/unit/value_object/test_unit_price.py index dce0777..6eb4943 100644 --- a/tests/multisafepay/unit/value_object/test_unit_price.py +++ b/tests/multisafepay/unit/value_object/test_unit_price.py @@ -15,36 +15,24 @@ def test_unit_price_initialization(): - """ - Test the initialization of the UnitPrice object with a valid unit price. - - """ + """Test the initialization of the UnitPrice object with a valid unit price.""" unit_price = UnitPrice(unit_price=19.99) assert unit_price.unit_price == 19.99 def test_empty_unit_price_initialization(): - """ - Test the initialization of the UnitPrice object with an empty dictionary. - - """ + """Test the initialization of the UnitPrice object with an empty dictionary.""" with pytest.raises(ValidationError): UnitPrice(unit_price={}) def test_valid_cast_unit_price_initialization(): - """ - Test the initialization of the UnitPrice object with a string unit price. - - """ + """Test the initialization of the UnitPrice object with a string unit price.""" unit_price = UnitPrice(unit_price="19.99") assert unit_price.unit_price == 19.99 def test_unit_price_get_unit_price(): - """ - Test the get method of the UnitPrice object. - - """ + """Test the get method of the UnitPrice object.""" unit_price = UnitPrice(unit_price=19.99) assert unit_price.get() == 19.99 diff --git a/tests/multisafepay/unit/value_object/test_unit_weight.py b/tests/multisafepay/unit/value_object/test_unit_weight.py index f6efe6d..fa7246b 100644 --- a/tests/multisafepay/unit/value_object/test_unit_weight.py +++ b/tests/multisafepay/unit/value_object/test_unit_weight.py @@ -15,58 +15,44 @@ def test_weight_initialization(): - """ - Test the initialization of the Weight object with valid unit and quantity. - """ + """Test the initialization of the Weight object with valid unit and quantity.""" weight = Weight(unit="kg", value=10) assert weight.unit == "kg" assert weight.value == 10 def test_empty_weight_initialization(): - """ - Test the initialization of the Weight object with no unit or quantity. - """ + """Test the initialization of the Weight object with no unit or quantity.""" weight = Weight() assert weight.unit is None assert weight.value is None def test_cast_allowed_weight_unit(): - """ - Test the initialization of the Weight object with a numeric unit. - """ + """Test the initialization of the Weight object with a numeric unit.""" weight = Weight(unit=0, value=10) assert weight.unit == "0" def test_invalid_weight_unit(): - """ - Test the initialization of the Weight object with an invalid unit type. - """ + """Test the initialization of the Weight object with an invalid unit type.""" with pytest.raises(ValidationError): Weight(unit={}, value=10) def test_invalid_weight_quantity(): - """ - Test the initialization of the Weight object with an invalid quantity type. - """ + """Test the initialization of the Weight object with an invalid quantity type.""" with pytest.raises(ValidationError): Weight(unit="kg", value={}) def test_weight_get_unit(): - """ - Test the get_unit method of the Weight object. - """ + """Test the get_unit method of the Weight object.""" weight = Weight(unit="lb", value=5) assert weight.get_unit() == "lb" def test_weight_get_quantity(): - """ - Test the get_quantity method of the Weight object. - """ + """Test the get_quantity method of the Weight object.""" weight = Weight(unit="g", value=500) assert weight.value == 500