Skip to content

Commit

Permalink
Change: support the active attribute in EmailForward (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggalmazor authored Nov 22, 2024
1 parent 0f36378 commit 0a3e221
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions dnsimple/struct/email_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/listEmailForwards/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -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":"[email protected]","created_at":"2017-05-25T19:23:16Z","updated_at":"2017-05-25T19:23:16Z","from":".*@a-domain.com","to":"[email protected]"}],"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":"[email protected]","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":"[email protected]","destination_email":"[email protected]","active":false,"created_at":"2017-05-25T19:23:16Z","updated_at":"2017-05-25T19:23:16Z","from":"[email protected]","to":"john.doe@example.com"}],"pagination":{"current_page":1,"per_page":30,"total_entries":1,"total_pages":1}}
14 changes: 12 additions & 2 deletions tests/service/domains_email_forwards_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('[email protected]', email_forwards[0].alias_email)
self.assertEqual("[email protected]", 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('[email protected]', email_forwards[1].alias_email)
self.assertEqual("[email protected]", email_forwards[1].destination_email)
self.assertEqual(False, email_forwards[1].active)

@responses.activate
def test_list_email_forwards_supports_sorting(self):
Expand Down

0 comments on commit 0a3e221

Please sign in to comment.