From 0a3e2210df7389408fb4c736001f28e48123ef03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Guti=C3=A9rrez?= Date: Fri, 22 Nov 2024 10:31:18 +0100 Subject: [PATCH] Change: support the `active` attribute in `EmailForward` (#454) --- dnsimple/struct/email_forward.py | 1 + .../fixtures/v2/api/listEmailForwards/success.http | 2 +- tests/service/domains_email_forwards_test.py | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/dnsimple/struct/email_forward.py b/dnsimple/struct/email_forward.py index f5d4c42..5c1b9cf 100644 --- a/dnsimple/struct/email_forward.py +++ b/dnsimple/struct/email_forward.py @@ -15,6 +15,7 @@ class EmailForward(Struct): """DEPRECATED: The full email address to forward to""" alias_email = None destination_email = None + active = None created_at = None """When the email forward was created in DNSimple""" updated_at = None diff --git a/tests/fixtures/v2/api/listEmailForwards/success.http b/tests/fixtures/v2/api/listEmailForwards/success.http index 4dd4074..33e5463 100644 --- a/tests/fixtures/v2/api/listEmailForwards/success.http +++ b/tests/fixtures/v2/api/listEmailForwards/success.http @@ -13,4 +13,4 @@ X-Request-Id: e42df983-a8a5-4123-8c74-fb89ab934aba X-Runtime: 0.025456 Strict-Transport-Security: max-age=63072000 -{"data":[{"id":24809,"domain_id":235146,"alias_email":".*@a-domain.com","destination_email":"jane.smith@example.com","created_at":"2017-05-25T19:23:16Z","updated_at":"2017-05-25T19:23:16Z","from":".*@a-domain.com","to":"jane.smith@example.com"}],"pagination":{"current_page":1,"per_page":30,"total_entries":1,"total_pages":1}} +{"data":[{"id":24809,"domain_id":235146,"alias_email":"foo@a-domain.com","destination_email":"jane.smith@example.com","active":true,"created_at":"2017-05-25T19:23:16Z","updated_at":"2017-05-25T19:23:16Z","from":"foo@a-domain.com","to":"jane.smith@example.com"},{"id":24810,"domain_id":235146,"alias_email":"bar@a-domain.com","destination_email":"john.doe@example.com","active":false,"created_at":"2017-05-25T19:23:16Z","updated_at":"2017-05-25T19:23:16Z","from":"bar@a-domain.com","to":"john.doe@example.com"}],"pagination":{"current_page":1,"per_page":30,"total_entries":1,"total_pages":1}} diff --git a/tests/service/domains_email_forwards_test.py b/tests/service/domains_email_forwards_test.py index c2070d5..c36a2bb 100644 --- a/tests/service/domains_email_forwards_test.py +++ b/tests/service/domains_email_forwards_test.py @@ -15,9 +15,19 @@ def test_list_email_forwards(self): fixture_name='listEmailForwards/success')) email_forwards = self.domains.list_email_forwards(1010, 'example.com').data - self.assertEqual(1, len(email_forwards)) + self.assertEqual(2, len(email_forwards)) self.assertIsInstance(email_forwards[0], EmailForward) - self.assertEqual('.*@a-domain.com', email_forwards[0].email_from) + self.assertEqual(24809, email_forwards[0].id) + self.assertEqual(235146, email_forwards[0].domain_id) + self.assertEqual('foo@a-domain.com', email_forwards[0].alias_email) + self.assertEqual("jane.smith@example.com", email_forwards[0].destination_email) + self.assertEqual(True, email_forwards[0].active) + self.assertIsInstance(email_forwards[1], EmailForward) + self.assertEqual(24810, email_forwards[1].id) + self.assertEqual(235146, email_forwards[1].domain_id) + self.assertEqual('bar@a-domain.com', email_forwards[1].alias_email) + self.assertEqual("john.doe@example.com", email_forwards[1].destination_email) + self.assertEqual(False, email_forwards[1].active) @responses.activate def test_list_email_forwards_supports_sorting(self):