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
2 changes: 2 additions & 0 deletions dnsimple/struct/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class Account(Struct):
"""The account ID in DNSimple"""
email = None
"""The account email"""
name = None
"""The account name"""
plan_identifier = None
"""The identifier of the plan the account is subscribed to"""
created_at = None
Expand Down
9 changes: 6 additions & 3 deletions dnsimple/struct/domain_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@
class DomainPushInput(dict):
"""Represents the data to send to the DNSimple API to initiate a push"""

def __init__(self, new_account_email=None, contact_id=None):
def __init__(self, new_account_email=None, new_domain_push_identifier=None, contact_id=None):
"""
Creates a new DomainPushInput

:param new_account_email: str
The target account email address (Required when initiating a push)
Deprecated: Use new_domain_push_identifier instead.
The target account email address
:param new_domain_push_identifier: str
The target domain push identifier (Required when initiating a push)
:param contact_id: int
A contact that belongs to the target DNSimple account. The contact will be used as new registrant for the
domain, if the domain is registered with DNSimple (Required when accepting a push)
"""
dict.__init__(self, new_account_email=new_account_email, contact_id=contact_id)
dict.__init__(self, new_account_email=new_account_email, new_domain_push_identifier=new_domain_push_identifier, contact_id=contact_id)

def to_json(self):
return json.dumps(omitempty(self))
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/accounts/success-account.http
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ x-permitted-cross-domain-policies: none
x-xss-protection: 1; mode=block
strict-transport-security: max-age=31536000

{"data":[{"id":123,"email":"john@example.com","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"}]}
{"data":[{"id":123,"email":"john@example.com","name":"John","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"}]}
2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/accounts/success-user.http
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ x-permitted-cross-domain-policies: none
x-xss-protection: 1; mode=block
strict-transport-security: max-age=31536000

{"data":[{"id":123,"email":"john@example.com","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"},{"id":456,"email":"ops@company.com","plan_identifier":"teams-v1-monthly","created_at":"2012-03-16T16:02:54Z","updated_at":"2016-06-14T11:23:16Z"}]}
{"data":[{"id":123,"email":"john@example.com","name":"John","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"},{"id":456,"email":"ops@company.com","name":"Ops Company","plan_identifier":"teams-v1-monthly","created_at":"2012-03-16T16:02:54Z","updated_at":"2016-06-14T11:23:16Z"}]}

2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/listAccounts/success-account.http
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ x-permitted-cross-domain-policies: none
x-xss-protection: 1; mode=block
strict-transport-security: max-age=31536000

{"data":[{"id":123,"email":"john@example.com","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"}]}
{"data":[{"id":123,"email":"john@example.com","name":"John","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"}]}
2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/listAccounts/success-user.http
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ x-permitted-cross-domain-policies: none
x-xss-protection: 1; mode=block
strict-transport-security: max-age=31536000

{"data":[{"id":123,"email":"john@example.com","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"},{"id":456,"email":"ops@company.com","plan_identifier":"teams-v1-monthly","created_at":"2012-03-16T16:02:54Z","updated_at":"2016-06-14T11:23:16Z"}]}
{"data":[{"id":123,"email":"john@example.com","name":"John","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"},{"id":456,"email":"ops@company.com","name":"Ops Company","plan_identifier":"teams-v1-monthly","created_at":"2012-03-16T16:02:54Z","updated_at":"2016-06-14T11:23:16Z"}]}
2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/whoami/success-account.http
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ x-request-id: 15a7f3a5-7ee5-4e36-ac5a-8c21c2e1fffd
x-runtime: 0.141588
strict-transport-security: max-age=31536000

{"data":{"user":null,"account":{"id":1,"email":"example-account@example.com","plan_identifier":"teams-v1-monthly","created_at":"2015-09-18T23:04:37Z","updated_at":"2016-06-09T20:03:39Z"}}}
{"data":{"user":null,"account":{"id":1,"email":"example-account@example.com","name":"Example Account","plan_identifier":"teams-v1-monthly","created_at":"2015-09-18T23:04:37Z","updated_at":"2016-06-09T20:03:39Z"}}}
2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/whoami/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ x-request-id: 15a7f3a5-7ee5-4e36-ac5a-8c21c2e1fffd
x-runtime: 0.141588
strict-transport-security: max-age=31536000

{"data":{"user":null,"account":{"id":1,"email":"example-account@example.com","plan_identifier":"teams-v1-monthly","created_at":"2015-09-18T23:04:37Z","updated_at":"2016-06-09T20:03:39Z"}}}
{"data":{"user":null,"account":{"id":1,"email":"example-account@example.com","name":"Example Account","plan_identifier":"teams-v1-monthly","created_at":"2015-09-18T23:04:37Z","updated_at":"2016-06-09T20:03:39Z"}}}
1 change: 1 addition & 0 deletions tests/service/accounts_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def test_list_accounts(self):
accounts = self.accounts.list_accounts().data
self.assertEqual(1, len(accounts))
self.assertIsInstance(accounts[0], Account)
self.assertEqual('John', accounts[0].name)

@responses.activate
def test_list_users(self):
Expand Down
10 changes: 10 additions & 0 deletions tests/service/domains_pushes_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ def test_initiate_push(self):
self.assertEqual('2016-08-11T10:16:03Z', push.updated_at)
self.assertIsNone(push.accepted_at)

@responses.activate
def test_initiate_push_with_domain_push_identifier(self):
responses.add(DNSimpleMockResponse(method=responses.POST,
path='/2020/domains/1/pushes',
fixture_name='initiatePush/success'))
push = self.domains.initiate_push(2020, 1, DomainPushInput(new_domain_push_identifier='abc123')).data

self.assertEqual(1, push.id)
self.assertEqual(2020, push.account_id)

@responses.activate
def test_list_pushes(self):
responses.add(DNSimpleMockResponse(method=responses.GET,
Expand Down