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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Adyen/services/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ def __getattr__(self, attr):
client_attr = ["username", "password", "platform"]
if attr in client_attr:
return self.client[attr]
raise AttributeError(
f"'{self.__class__.__name__}' object has no attribute '{attr}'"
)


class AdyenServiceBase(AdyenBase):
Expand Down
8 changes: 8 additions & 0 deletions test/ClientTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@ class TestClient(unittest.TestCase):
client.xapikey = "YOUR_API_KEY"
client.platform = "test"
lib_version = settings.LIB_VERSION

def test_unknown_properties_raise_attribute_error(self):
with self.assertRaises(AttributeError):
_ = self.adyen.foobar
# Resolve parent attributes outside of assertRaises to avoid false positives
payments_api = self.adyen.payment.payments_api
with self.assertRaises(AttributeError):
_ = payments_api.foobar