-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add upsert_person method to ActionNetwork (#734)
* Add upsert_person method to ActionNetwork, add deprecation warnings to add_person and update_person
- Loading branch information
Showing
2 changed files
with
46 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,8 +20,8 @@ def setUp(self, m): | |
self.fake_customer_email_1 = 'fake_customer_email_1@fake_customer_email.com' | ||
self.fake_customer_email_2 = 'fake_customer_email_2@fake_customer_email.com' | ||
self.fake_filter_by_email_1 = f"filter eq '{self.fake_customer_email_1}'" | ||
self.fake_person_id_1 = "fake_person_id_1" | ||
self.fake_person_id_2 = "fake_person_id_2" | ||
self.fake_person_id_1 = "action_network:fake_person_id_1" | ||
self.fake_person_id_2 = "action_network:fake_person_id_2" | ||
self.fake_tag_id_1 = "fake_tag_id_1" | ||
self.fake_tag_id_2 = "fake_tag_id_2" | ||
self.fake_tag_filter = "name eq 'fake_tag_1'" | ||
|
@@ -133,6 +133,16 @@ def setUp(self, m): | |
'modified_date': self.fake_datetime, | ||
'identifiers': [self.fake_tag_id_1], | ||
'_links': {'self': {'href': self.fake_tag_id_1}}}]}} | ||
self.fake_upsert_person = { | ||
'given_name': 'Fakey', | ||
'family_name': 'McFakerson', | ||
'identifiers': [self.fake_person_id_1], | ||
'email_address': [{'primary': True, | ||
'address': '[email protected]', | ||
'status': 'unsubscribed'}], | ||
'created_date': self.fake_datetime, | ||
'modified_date': self.fake_datetime | ||
} | ||
self.fake_person = [ | ||
{'given_name': 'Fakey', | ||
'family_name': 'McFakerson', | ||
|
@@ -264,6 +274,11 @@ def test_get_tag(self, m): | |
m.get(f"{self.api_url}/tags/{self.fake_tag_id_1}", text=json.dumps(self.fake_tag)) | ||
self.assertEqual(self.an.get_tag(self.fake_tag_id_1), self.fake_tag) | ||
|
||
@requests_mock.Mocker() | ||
def test_upsert_person(self, m): | ||
m.post(f"{self.api_url}/people", text=json.dumps(self.fake_upsert_person)) | ||
self.assertEqual(self.an.upsert_person(**self.fake_upsert_person), self.fake_upsert_person) | ||
|
||
@requests_mock.Mocker() | ||
def test_update_person(self, m): | ||
m.put(f"{self.api_url}/people/{self.fake_person_id_1}", | ||
|