From 3886b16fefbb62c37d9698cb36c8952c8a69c2a7 Mon Sep 17 00:00:00 2001 From: NirTatcher Date: Tue, 26 Sep 2023 19:23:40 +0300 Subject: [PATCH 01/10] working on adding a functio to an and took care of a lint issues --- parsons/action_network/action_network.py | 1 + parsons/facebook_ads/facebook_ads.py | 2 +- .../test_action_network.py | 65 +++++++++++++++++++ test/test_databases/fakes.py | 4 +- 4 files changed, 69 insertions(+), 3 deletions(-) diff --git a/parsons/action_network/action_network.py b/parsons/action_network/action_network.py index 9c2e499e9e..c60b9a68ba 100644 --- a/parsons/action_network/action_network.py +++ b/parsons/action_network/action_network.py @@ -427,3 +427,4 @@ def create_event(self, title, start_date=None, location=None): event_dict["event_id"] = an_event_id return event_dict + diff --git a/parsons/facebook_ads/facebook_ads.py b/parsons/facebook_ads/facebook_ads.py index 0733cfed8b..c7e9eb826a 100644 --- a/parsons/facebook_ads/facebook_ads.py +++ b/parsons/facebook_ads/facebook_ads.py @@ -390,7 +390,7 @@ def add_users_to_custom_audience(self, audience_id, users_table): self.access_token, audience_id, schema, - data[i : i + batch_size], + data[i: i + batch_size], i, num_rows, ) diff --git a/test/test_action_network/test_action_network.py b/test/test_action_network/test_action_network.py index c6984d3861..c57ffd359f 100644 --- a/test/test_action_network/test_action_network.py +++ b/test/test_action_network/test_action_network.py @@ -348,6 +348,61 @@ def setUp(self, m): }, "event_id": "fake-id", } + self.fake_fundraising_pages = { + "total_pages": 1, + "per_page": 1, + "page": 1, + "total_records": 1, + "_links": { + "next": {"href": f"{self.api_url}/fundraising_pages?page=2"}, + "osdi:fundraising_pages": [ + {"href": f"{self.api_url}/fundraising_pages/{self.fake_tag_id_1}"}, + ], + "curies": [ + {"name": "osdi", "templated": True}, + {"name": "action_network", "templated": True}, + ], + "self": {"href": f"{self.api_url}/fundraising_pages"}, + }, + "_embedded": { + "osdi:fundraising_pages": [ + { + "identifiers": [ + "" + ], + "created_date": self.fake_date, + "total_donations": 0, + "total_amount": "0.00", + "currency": "USD", + "action_network:sponsor": { + "title": "", + "browser_url": "" + }, + "_links": { + "self": { + "href": f"{self.api_url}/fundraising_pages" + }, + "osdi:creator": { + "href": "fake_url" + }, + "osdi:donations": { + "href": "fake_url" + }, + "osdi:record_donation_helper": { + "href": "fake_url" + } + }, + "modified_date": self.fake_date, + "origin_system": "Test", + "title": "Hello", + "_embedded": { + "osdi:creator": "" + }, + "action_network:hidden": False + } + ] + }, + } @requests_mock.Mocker() def test_get_page(self, m): @@ -502,3 +557,13 @@ def test_filter_on_get_unsupported_entry(self, m): self.an._get_entry_list("tags", filter=self.fake_tag_filter), Table(self.fake_tag_list["_embedded"]["osdi:tags"]), ) + + @requests_mock.Mocker() + def test_get_fundraising_pages(self, m): + m.get( + f"{self.api_url}/fundraising_pages", + text=json.dumps(self.fake_fundraising_pages), + ) + assert_matching_tables( + self.an._get_entry_list("fundraising_pages", 1, 1), + self.fake_fundraising_pages["_embedded"]["osdi:fundraising_pages"]) diff --git a/test/test_databases/fakes.py b/test/test_databases/fakes.py index 049bba960b..97ff05c668 100644 --- a/test/test_databases/fakes.py +++ b/test/test_databases/fakes.py @@ -98,7 +98,7 @@ def get_rows(self, offset=0, chunk_size=None, order_by=None): if order_by: data.sort(order_by) - return Table(data[offset : chunk_size + offset]) + return Table(data[offset: chunk_size + offset]) def get_new_rows_count(self, primary_key_col, start_value=None): data = self.data.select_rows(lambda row: row[primary_key_col] > start_value) @@ -108,4 +108,4 @@ def get_new_rows(self, primary_key, cutoff_value, offset=0, chunk_size=None): data = self.data.select_rows(lambda row: row[primary_key] > cutoff_value) data.sort(primary_key) - return Table(data[offset : chunk_size + offset]) + return Table(data[offset: chunk_size + offset]) From 84b38cb489a6e066a29d562bded999b6902907aa Mon Sep 17 00:00:00 2001 From: NirTatcher Date: Thu, 28 Sep 2023 17:04:06 +0300 Subject: [PATCH 02/10] init --- parsons/action_network/action_network.py | 374 ++++++++++++++++++++++- 1 file changed, 373 insertions(+), 1 deletion(-) diff --git a/parsons/action_network/action_network.py b/parsons/action_network/action_network.py index c60b9a68ba..fbdf6731e9 100644 --- a/parsons/action_network/action_network.py +++ b/parsons/action_network/action_network.py @@ -51,7 +51,9 @@ def _get_entry_list(self, object_name, limit=None, per_page=25, filter=None): while True: response = self._get_page(object_name, page, per_page, filter=filter) page = page + 1 - response_list = response["_embedded"][f"osdi:{object_name}"] + print(list(response["_embedded"])) + # response_list = response["_embedded"][f"osdi:{object_name.split('/')[-1]}"] + response_list = response["_embedded"][list(response["_embedded"])[0]] if not response_list: return Table(return_list) return_list.extend(response_list) @@ -428,3 +430,373 @@ def create_event(self, title, start_date=None, location=None): return event_dict + def get_events(self,limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self: + `Returns:` + A JSON with all the events entries + """ + if (page): + return self._get_page("events", page, per_page, filter) + return self._get_entry_list("events", limit, per_page, filter) + + def get_event(self,event_id): + """ + `Args:` + self: + event_id: the unique id of the event + `Returns:` + A JSON with event entry + """ + return self.api.get_request(f"events/{event_id}") + def get_event_attendances(self,event_id,limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self: + event_id: the unique id of the event + `Returns:` + A JSON with all the attendances related to the event entry + """ + if (page): + return self._get_page(f"events/{event_id}/attendances", page, per_page, filter) + return self._get_entry_list(f"events/{event_id}/attendances", limit, per_page, filter) + def create_fundraising_page(self, title, origin_system, description=None): + """ + `Args:` + self: + title: The title of the fundraising page + origin_system: The origin system for the fundraiser + description (optional): A description about the fundraising page + `Returns:` + A JSON with all the attendances related to the event entry + """ + data = {"title": title,"origin_system": origin_system} + if (description): + data["description"] = description + return self.api.post_request(url=f"{self.api_url}/fundraising_pages",params={"headers":{"Content-Type":"application/json"}},data=json.dumps(data)) + + def update_fundraising_page(self, fundraising_page_id ,title=None, origin_system=None, description=None): + """ + `Args:` + self: + title: The title of the fundraising page + origin_system: The origin system for the fundraiser + description (optional): A description about the fundraising page + `Returns:` + A JSON with all the attendances related to the event entry + """ + data = {} + if (description): + data["description"] = description + if(title): + data["title"]=title + if(origin_system): + data["origin_system"]=origin_system + return self.api.put_request(url=f"{self.api_url}/fundraising_pages/{fundraising_page_id}",params={"headers":{"Content-Type":"application/json"}},data=json.dumps(data)) + + def get_fundraising_page(self, fundraising_page_id): + """ + `Args:` + self: + fundraising_page_id: The id of the fundraiser + `Returns:` + A JSON with fundraising_page data or an error + """ + return self.api.get_request(url=f"fundraising_pages/{fundraising_page_id}") + def get_fundraising_pages(self, limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self + `Returns:` + A JSON with all the fundraising_pages entries + """ + if(page): + return self._get_page("fundraising_pages", page, per_page, filter) + return self._get_entry_list("fundraising_pages", limit,) + + def get_fundraising_page_donations(self,fundraising_page_id,limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self: + fundraising_page_id: The id of the fundraiser + `Returns:` + A JSON with fundraising_page data or an error + """ + if(page): + return self._get_page(f"fundraising_pages/{fundraising_page_id}/donations",page,per_page,filter) + return self._get_entry_list(f"fundraising_pages/{fundraising_page_id}/donations",limit,per_page,filter) + + def get_donation(self,donation_id): + """ + `Args:` + self: + donation_id: The unique id of the donation + `Returns:` + A JSON with donation data or an error + """ + return self.api.get_request(url=f"donations/{donation_id}") + def get_donations(self,limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self: + `Returns:` + A JSON with all of the donations entries + """ + if (page): + return self._get_page(f"donations", page, per_page, filter) + return self._get_entry_list(f"donations", limit, per_page, filter) + + def get_forms(self,limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self: + `Returns:` + A JSON with all of the forms entries + """ + if (page): + return self._get_page(f"forms", page, per_page, filter) + return self._get_entry_list(f"forms", limit, per_page, filter) + + def get_form(self,form_id): + """ + `Args:` + self: + form_id: the unique id of the form + `Returns:` + A JSON with form entry + """ + return self.api.get_request(f"forms/{form_id}") + def get_form_submissions(self, form_id, limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self: + `Returns:` + A JSON with all the submissions entries related to the form + """ + if (page): + return self._get_page(f"forms/{form_id}/submissions", page, per_page, filter) + return self._get_entry_list(f"forms/{form_id}/submissions", limit, per_page, filter) + + def get_person_submissions(self, person_id, limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self: + `Returns:` + A JSON with all the submissions entries related with our group + """ + if (page): + return self._get_page(f"people/{person_id}/submissions", page, per_page, filter) + return self._get_entry_list(f"people/{person_id}/submissions", limit, per_page, filter) + + def get_form_submission(self, form_id, submission_id): + """ + `Args:` + self: + submission_id: the unique id of the submission + `Returns:` + A JSON with the submission entry + """ + return self.api.get_request(f"forms/{form_id}/submissions/{submission_id}") + + def get_person_submission(self, person_id, submission_id): + """ + `Args:` + self: + submission_id: the unique id of the submission + `Returns:` + A JSON with the submission entry + """ + return self.api.get_request(f"people/{person_id}/submissions/{submission_id}") + + def get_advocacy_campaigns(self,limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self: + `Returns:` + A JSON with all of the advocacy_campaigns (letters) entries + """ + if (page): + return self._get_page(f"advocacy_campaigns", page, per_page, filter) + return self._get_entry_list(f"advocacy_campaigns", limit, per_page, filter) + def get_advocacy_campaign(self,advocacy_campaign_id): + """ + `Args:` + self: + advocacy_campaign_id: the unique id of the advocacy_campaign + `Returns:` + A JSON with advocacy_campaign entry + """ + return self.api.get_request(f"advocacy_campaigns/{advocacy_campaign_id}") + def get_advocacy_campaign_outreaches(self,advocacy_campaign_id,limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self: + advocacy_campaign_id: the unique id of the advocacy_campaign + `Returns:` + A JSON with all the outreaches entries related to the advocacy_campaign_id + """ + if (page): + return self._get_page(f"advocacy_campaigns/{advocacy_campaign_id}/outreaches", page, per_page, filter) + return self._get_entry_list(f"advocacy_campaigns/{advocacy_campaign_id}/outreaches", limit, per_page, filter) + def get_person_outreaches(self,person_id, limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self: + `Returns:` + A JSON with all the outreaches entries related to our group + """ + if (page): + return self._get_page(f"people/{person_id}/outreaches", page, per_page, filter) + return self._get_entry_list(f"people/{person_id}/outreaches", limit, per_page, filter) + + def get_advocacy_campaign_outreach(self, advocacy_campaign_id , outreach_id): + """ + `Args:` + self: + outreach_id: the unique id of the outreach + `Returns:` + A JSON with the outreach entry + """ + return self.api.get_request(f"advocacy_campaigns/{advocacy_campaign_id}/outreaches/{outreach_id}") + + def get_campaigns(self,limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self: + `Returns:` + A JSON with all of the campaigns entries + """ + if (page): + return self._get_page("campaigns", page, per_page, filter) + return self._get_entry_list("campaigns", limit, per_page, filter) + def get_campaign(self,campaign_id): + """ + `Args:` + self: + campaign_id: the unique id of the campaign + `Returns:` + A JSON with the campaign entry + """ + return self.api.get_request(f"campaigns/{campaign_id}") + def get_event_campaigns(self,limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self: + `Returns:` + A JSON with all the event_campaigns entries + """ + if (page): + return self._get_page("event_campaigns", page, per_page, filter) + return self._get_entry_list("event_campaigns", limit, per_page, filter) + + def get_event_campaign(self,event_campaign_id): + """ + `Args:` + self: + event_campaign_id: the unique id of the event_campaign + `Returns:` + A JSON with event_campaign entry + """ + return self.api.get_request(f"event_campaigns/{event_campaign_id}") + def get_event_campaign_events(self,event_campaign_id): + """ + `Args:` + self: + event_campaign_id: the unique id of the event_campaign + `Returns:` + A JSON with all the eventes related to the event_campaign entry + """ + return self.api.get_request(f"event_campaigns/{event_campaign_id}/events") + def get_person_attendances(self,person_id,limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self: + `Returns:` + A JSON with all the attendances entries + """ + if (page): + return self._get_page(f"people/{person_id}/attendances", page, per_page, filter) + return self._get_entry_list(f"people/{person_id}/attendances", limit, per_page, filter) + + + def get_event_attendance(self,event_id,attendance_id): + """ + `Args:` + self: + attendance_id: the unique id of the attendance + `Returns:` + A JSON with the attendance entry + """ + return self.api.get_request(f"events/{event_id}/attendances/{attendance_id}") + def get_person_attendance(self,person_id,attendance_id): + """ + `Args:` + self: + attendance_id: the unique id of the attendance + `Returns:` + A JSON with the attendance entry + """ + return self.api.get_request(f"people/{person_id}/attendances/{attendance_id}") + + def get_petitions(self,limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self: + `Returns:` + A JSON with all of the petitions entries + """ + if (page): + return self._get_page(f"petitions", page, per_page, filter) + return self._get_entry_list(f"petitions", limit, per_page, filter) + + def get_petition(self,petition_id): + """ + `Args:` + self: + petition_id: the unique id of the petition + `Returns:` + A JSON with the petition entry + """ + return self.api.get_request(f"petitions/{petition_id}") + def get_petition_signatures(self,petition_id,limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self: + petition_id: the unique id of the petition + `Returns:` + A JSON with all the signatures related to the petition entry + """ + if (page): + return self._get_page(f"petitions/{petition_id}/signatures", page, per_page, filter) + return self._get_entry_list(f"petitions/{petition_id}/signatures", limit, per_page, filter) + def get_person_signatures(self,person_id,limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + self: + petition_id: the unique id of the petition + `Returns:` + A JSON with all the signatures related to the petition entry + """ + if (page): + return self._get_page(f"people/{person_id}/signatures", page, per_page, filter) + return self._get_entry_list(f"people/{person_id}/signatures", limit, per_page, filter) + + def get_petition_signature(self,petition_id,signature_id): + """ + `Args:` + self: + signature_id: the unique id of the signature + `Returns:` + A JSON with the signature entry + """ + return self.api.get_request(f"petitions/{petition_id}/signatures/{signature_id}") + def get_person_signature(self,person_id,signature_id): + """ + `Args:` + self: + signature_id: the unique id of the signature + `Returns:` + A JSON with the signature entry + """ + return self.api.get_request(f"people/{person_id}/signatures/{signature_id}") From eea90ba7e340e9a00bc07a6862f0c5c8e6375e59 Mon Sep 17 00:00:00 2001 From: NirTatcher Date: Thu, 28 Sep 2023 17:33:57 +0300 Subject: [PATCH 03/10] working on all get functions --- parsons/action_network/action_network.py | 311 ++++++++++++++++------- 1 file changed, 222 insertions(+), 89 deletions(-) diff --git a/parsons/action_network/action_network.py b/parsons/action_network/action_network.py index fbdf6731e9..fabee9e87f 100644 --- a/parsons/action_network/action_network.py +++ b/parsons/action_network/action_network.py @@ -433,7 +433,15 @@ def create_event(self, title, start_date=None, location=None): def get_events(self,limit=None, per_page=25, page=None, filter=None): """ `Args:` - self: + limit: + The number of entries to return. When None, returns all entries. + per_page + The number of entries per page to return. 25 maximum. + page + Which page of results to return + filter + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. `Returns:` A JSON with all the events entries """ @@ -444,7 +452,6 @@ def get_events(self,limit=None, per_page=25, page=None, filter=None): def get_event(self,event_id): """ `Args:` - self: event_id: the unique id of the event `Returns:` A JSON with event entry @@ -453,61 +460,44 @@ def get_event(self,event_id): def get_event_attendances(self,event_id,limit=None, per_page=25, page=None, filter=None): """ `Args:` - self: event_id: the unique id of the event + limit: + The number of entries to return. When None, returns all entries. + per_page + The number of entries per page to return. 25 maximum. + page + Which page of results to return + filter + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. `Returns:` - A JSON with all the attendances related to the event entry + A JSON with the attendances entries related to the event """ if (page): return self._get_page(f"events/{event_id}/attendances", page, per_page, filter) return self._get_entry_list(f"events/{event_id}/attendances", limit, per_page, filter) - def create_fundraising_page(self, title, origin_system, description=None): - """ - `Args:` - self: - title: The title of the fundraising page - origin_system: The origin system for the fundraiser - description (optional): A description about the fundraising page - `Returns:` - A JSON with all the attendances related to the event entry - """ - data = {"title": title,"origin_system": origin_system} - if (description): - data["description"] = description - return self.api.post_request(url=f"{self.api_url}/fundraising_pages",params={"headers":{"Content-Type":"application/json"}},data=json.dumps(data)) - - def update_fundraising_page(self, fundraising_page_id ,title=None, origin_system=None, description=None): - """ - `Args:` - self: - title: The title of the fundraising page - origin_system: The origin system for the fundraiser - description (optional): A description about the fundraising page - `Returns:` - A JSON with all the attendances related to the event entry - """ - data = {} - if (description): - data["description"] = description - if(title): - data["title"]=title - if(origin_system): - data["origin_system"]=origin_system - return self.api.put_request(url=f"{self.api_url}/fundraising_pages/{fundraising_page_id}",params={"headers":{"Content-Type":"application/json"}},data=json.dumps(data)) def get_fundraising_page(self, fundraising_page_id): """ `Args:` - self: fundraising_page_id: The id of the fundraiser `Returns:` - A JSON with fundraising_page data or an error + A JSON with fundraising_page entry or an error """ return self.api.get_request(url=f"fundraising_pages/{fundraising_page_id}") def get_fundraising_pages(self, limit=None, per_page=25, page=None, filter=None): """ `Args:` - self + limit: + The number of entries to return. When None, returns all entries. + per_page + The number of entries per page to return. 25 maximum. + page + Which page of results to return + filter + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + `Returns:` A JSON with all the fundraising_pages entries """ @@ -518,10 +508,19 @@ def get_fundraising_pages(self, limit=None, per_page=25, page=None, filter=None) def get_fundraising_page_donations(self,fundraising_page_id,limit=None, per_page=25, page=None, filter=None): """ `Args:` - self: - fundraising_page_id: The id of the fundraiser + fundraising_page_id: The id of the fundraiser + limit: + The number of entries to return. When None, returns all entries. + per_page + The number of entries per page to return. 25 maximum. + page + Which page of results to return + filter + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + `Returns:` - A JSON with fundraising_page data or an error + A JSON with fundraising_page entry or an error """ if(page): return self._get_page(f"fundraising_pages/{fundraising_page_id}/donations",page,per_page,filter) @@ -530,7 +529,6 @@ def get_fundraising_page_donations(self,fundraising_page_id,limit=None, per_page def get_donation(self,donation_id): """ `Args:` - self: donation_id: The unique id of the donation `Returns:` A JSON with donation data or an error @@ -539,9 +537,17 @@ def get_donation(self,donation_id): def get_donations(self,limit=None, per_page=25, page=None, filter=None): """ `Args:` - self: + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. `Returns:` - A JSON with all of the donations entries + A JSON with all the donations entries """ if (page): return self._get_page(f"donations", page, per_page, filter) @@ -550,9 +556,17 @@ def get_donations(self,limit=None, per_page=25, page=None, filter=None): def get_forms(self,limit=None, per_page=25, page=None, filter=None): """ `Args:` - self: + limit: + The number of entries to return. When None, returns all entries. + per_page + The number of entries per page to return. 25 maximum. + page + Which page of results to return + filter + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. `Returns:` - A JSON with all of the forms entries + A JSON with all the forms entries """ if (page): return self._get_page(f"forms", page, per_page, filter) @@ -561,8 +575,8 @@ def get_forms(self,limit=None, per_page=25, page=None, filter=None): def get_form(self,form_id): """ `Args:` - self: - form_id: the unique id of the form + form_id: + The unique id of the form `Returns:` A JSON with form entry """ @@ -570,7 +584,18 @@ def get_form(self,form_id): def get_form_submissions(self, form_id, limit=None, per_page=25, page=None, filter=None): """ `Args:` - self: + form_id: + The unique id of the form + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + `Returns:` A JSON with all the submissions entries related to the form """ @@ -581,7 +606,17 @@ def get_form_submissions(self, form_id, limit=None, per_page=25, page=None, filt def get_person_submissions(self, person_id, limit=None, per_page=25, page=None, filter=None): """ `Args:` - self: + person_id: + The unique id of the person + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. `Returns:` A JSON with all the submissions entries related with our group """ @@ -592,8 +627,10 @@ def get_person_submissions(self, person_id, limit=None, per_page=25, page=None, def get_form_submission(self, form_id, submission_id): """ `Args:` - self: - submission_id: the unique id of the submission + form_id: + The unique id of the form + submission_id: + The unique id of the submission `Returns:` A JSON with the submission entry """ @@ -602,8 +639,10 @@ def get_form_submission(self, form_id, submission_id): def get_person_submission(self, person_id, submission_id): """ `Args:` - self: - submission_id: the unique id of the submission + person_id: + The unique id of the submission + submission_id: + The unique id of the submission `Returns:` A JSON with the submission entry """ @@ -612,7 +651,16 @@ def get_person_submission(self, person_id, submission_id): def get_advocacy_campaigns(self,limit=None, per_page=25, page=None, filter=None): """ `Args:` - self: + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + `Returns:` A JSON with all of the advocacy_campaigns (letters) entries """ @@ -622,8 +670,8 @@ def get_advocacy_campaigns(self,limit=None, per_page=25, page=None, filter=None) def get_advocacy_campaign(self,advocacy_campaign_id): """ `Args:` - self: - advocacy_campaign_id: the unique id of the advocacy_campaign + advocacy_campaign_id: + The unique id of the advocacy_campaign `Returns:` A JSON with advocacy_campaign entry """ @@ -631,10 +679,20 @@ def get_advocacy_campaign(self,advocacy_campaign_id): def get_advocacy_campaign_outreaches(self,advocacy_campaign_id,limit=None, per_page=25, page=None, filter=None): """ `Args:` - self: - advocacy_campaign_id: the unique id of the advocacy_campaign + advocacy_campaign_id: + The unique id of the advocacy_campaign + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + `Returns:` - A JSON with all the outreaches entries related to the advocacy_campaign_id + A JSON with all the outreaches entries related to the advocacy_campaign_id """ if (page): return self._get_page(f"advocacy_campaigns/{advocacy_campaign_id}/outreaches", page, per_page, filter) @@ -642,7 +700,18 @@ def get_advocacy_campaign_outreaches(self,advocacy_campaign_id,limit=None, per_p def get_person_outreaches(self,person_id, limit=None, per_page=25, page=None, filter=None): """ `Args:` - self: + person_id: + The unique id of the person + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + `Returns:` A JSON with all the outreaches entries related to our group """ @@ -653,8 +722,10 @@ def get_person_outreaches(self,person_id, limit=None, per_page=25, page=None, fi def get_advocacy_campaign_outreach(self, advocacy_campaign_id , outreach_id): """ `Args:` - self: - outreach_id: the unique id of the outreach + advocacy_campaign_id: + The uniqe id of the campaign + outreach_id: + The unique id of the outreach `Returns:` A JSON with the outreach entry """ @@ -663,7 +734,15 @@ def get_advocacy_campaign_outreach(self, advocacy_campaign_id , outreach_id): def get_campaigns(self,limit=None, per_page=25, page=None, filter=None): """ `Args:` - self: + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. `Returns:` A JSON with all of the campaigns entries """ @@ -673,8 +752,8 @@ def get_campaigns(self,limit=None, per_page=25, page=None, filter=None): def get_campaign(self,campaign_id): """ `Args:` - self: - campaign_id: the unique id of the campaign + campaign_id: + The unique id of the campaign `Returns:` A JSON with the campaign entry """ @@ -682,7 +761,15 @@ def get_campaign(self,campaign_id): def get_event_campaigns(self,limit=None, per_page=25, page=None, filter=None): """ `Args:` - self: + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. `Returns:` A JSON with all the event_campaigns entries """ @@ -693,8 +780,8 @@ def get_event_campaigns(self,limit=None, per_page=25, page=None, filter=None): def get_event_campaign(self,event_campaign_id): """ `Args:` - self: - event_campaign_id: the unique id of the event_campaign + event_campaign_id: + The unique id of the event_campaign `Returns:` A JSON with event_campaign entry """ @@ -702,8 +789,8 @@ def get_event_campaign(self,event_campaign_id): def get_event_campaign_events(self,event_campaign_id): """ `Args:` - self: - event_campaign_id: the unique id of the event_campaign + event_campaign_id: + The unique id of the event_campaign `Returns:` A JSON with all the eventes related to the event_campaign entry """ @@ -711,7 +798,17 @@ def get_event_campaign_events(self,event_campaign_id): def get_person_attendances(self,person_id,limit=None, per_page=25, page=None, filter=None): """ `Args:` - self: + person_id: + The unique id of the person + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. `Returns:` A JSON with all the attendances entries """ @@ -723,8 +820,10 @@ def get_person_attendances(self,person_id,limit=None, per_page=25, page=None, fi def get_event_attendance(self,event_id,attendance_id): """ `Args:` - self: - attendance_id: the unique id of the attendance + event_id: + The unique id of the event + attendance_id: + The unique id of the attendance `Returns:` A JSON with the attendance entry """ @@ -732,8 +831,10 @@ def get_event_attendance(self,event_id,attendance_id): def get_person_attendance(self,person_id,attendance_id): """ `Args:` - self: - attendance_id: the unique id of the attendance + person_id: + The unique id of the person + attendance_id: + The unique id of the attendance `Returns:` A JSON with the attendance entry """ @@ -742,7 +843,15 @@ def get_person_attendance(self,person_id,attendance_id): def get_petitions(self,limit=None, per_page=25, page=None, filter=None): """ `Args:` - self: + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. `Returns:` A JSON with all of the petitions entries """ @@ -753,8 +862,8 @@ def get_petitions(self,limit=None, per_page=25, page=None, filter=None): def get_petition(self,petition_id): """ `Args:` - self: - petition_id: the unique id of the petition + petition_id: + The unique id of the petition `Returns:` A JSON with the petition entry """ @@ -762,8 +871,17 @@ def get_petition(self,petition_id): def get_petition_signatures(self,petition_id,limit=None, per_page=25, page=None, filter=None): """ `Args:` - self: - petition_id: the unique id of the petition + petition_id: + The unique id of the petition + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. `Returns:` A JSON with all the signatures related to the petition entry """ @@ -773,8 +891,19 @@ def get_petition_signatures(self,petition_id,limit=None, per_page=25, page=None, def get_person_signatures(self,person_id,limit=None, per_page=25, page=None, filter=None): """ `Args:` - self: - petition_id: the unique id of the petition + person_id: + The unique id of the person + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + + `Returns:` A JSON with all the signatures related to the petition entry """ @@ -785,8 +914,10 @@ def get_person_signatures(self,person_id,limit=None, per_page=25, page=None, fil def get_petition_signature(self,petition_id,signature_id): """ `Args:` - self: - signature_id: the unique id of the signature + petition_id: + The unique id of the petition + signature_id: + The unique id of the signature `Returns:` A JSON with the signature entry """ @@ -794,8 +925,10 @@ def get_petition_signature(self,petition_id,signature_id): def get_person_signature(self,person_id,signature_id): """ `Args:` - self: - signature_id: the unique id of the signature + person_id: + The unique id of the person + signature_id: + The unique id of the signature `Returns:` A JSON with the signature entry """ From 64e1b530064b035484523ef63219f7e639f59709 Mon Sep 17 00:00:00 2001 From: NirTatcher Date: Sun, 1 Oct 2023 13:14:57 +0300 Subject: [PATCH 04/10] actionnetwork functions batch 1 is ready --- parsons/action_network/action_network.py | 999 ++++++++++-------- .../test_action_network.py | 9 +- 2 files changed, 549 insertions(+), 459 deletions(-) diff --git a/parsons/action_network/action_network.py b/parsons/action_network/action_network.py index fabee9e87f..78e64a1e82 100644 --- a/parsons/action_network/action_network.py +++ b/parsons/action_network/action_network.py @@ -51,8 +51,6 @@ def _get_entry_list(self, object_name, limit=None, per_page=25, filter=None): while True: response = self._get_page(object_name, page, per_page, filter=filter) page = page + 1 - print(list(response["_embedded"])) - # response_list = response["_embedded"][f"osdi:{object_name.split('/')[-1]}"] response_list = response["_embedded"][list(response["_embedded"])[0]] if not response_list: return Table(return_list) @@ -430,10 +428,73 @@ def create_event(self, title, start_date=None, location=None): return event_dict - def get_events(self,limit=None, per_page=25, page=None, filter=None): + def get_events(self, limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + limit: + The number of entries to return. When None, returns all entries. + per_page + The number of entries per page to return. 25 maximum. + page + Which page of results to return + filter + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + `Returns:` + A JSON with all the events entries """ - `Args:` + if page: + return self._get_page("events", page, per_page, filter) + return self._get_entry_list("events", limit, per_page, filter) + + def get_event(self, event_id): + """ + `Args:` + event_id: the unique id of the event + `Returns:` + A JSON with event entry + """ + return self.api.get_request(f"events/{event_id}") + + def get_event_attendances( + self, event_id, limit=None, per_page=25, page=None, filter=None + ): + """ + `Args:` + event_id: the unique id of the event limit: + The number of entries to return. When None, returns all entries. + per_page + The number of entries per page to return. 25 maximum. + page + Which page of results to return + filter + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + `Returns:` + A JSON with the attendances entries related to the event + """ + if page: + return self._get_page( + f"events/{event_id}/attendances", page, per_page, filter + ) + return self._get_entry_list( + f"events/{event_id}/attendances", limit, per_page, filter + ) + + def get_fundraising_page(self, fundraising_page_id): + """ + `Args:` + fundraising_page_id: The id of the fundraiser + `Returns:` + A JSON with fundraising_page entry + """ + return self.api.get_request(url=f"fundraising_pages/{fundraising_page_id}") + + def get_fundraising_pages(self, limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + limit: The number of entries to return. When None, returns all entries. per_page The number of entries per page to return. 25 maximum. @@ -442,494 +503,518 @@ def get_events(self,limit=None, per_page=25, page=None, filter=None): filter The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". When None, no filter is applied. - `Returns:` - A JSON with all the events entries - """ - if (page): - return self._get_page("events", page, per_page, filter) - return self._get_entry_list("events", limit, per_page, filter) - def get_event(self,event_id): + `Returns:` + A JSON with all the fundraising_pages entries """ - `Args:` - event_id: the unique id of the event - `Returns:` - A JSON with event entry - """ - return self.api.get_request(f"events/{event_id}") - def get_event_attendances(self,event_id,limit=None, per_page=25, page=None, filter=None): - """ - `Args:` - event_id: the unique id of the event - limit: - The number of entries to return. When None, returns all entries. - per_page - The number of entries per page to return. 25 maximum. - page - Which page of results to return - filter - The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". - When None, no filter is applied. - `Returns:` - A JSON with the attendances entries related to the event - """ - if (page): - return self._get_page(f"events/{event_id}/attendances", page, per_page, filter) - return self._get_entry_list(f"events/{event_id}/attendances", limit, per_page, filter) + if page: + return self._get_page("fundraising_pages", page, per_page, filter) + return self._get_entry_list( + "fundraising_pages", + limit, + ) - def get_fundraising_page(self, fundraising_page_id): + def get_fundraising_page_donations( + self, fundraising_page_id, limit=None, per_page=25, page=None, filter=None + ): """ - `Args:` - fundraising_page_id: The id of the fundraiser - `Returns:` - A JSON with fundraising_page entry or an error + `Args:` + fundraising_page_id: The id of the fundraiser + limit: + The number of entries to return. When None, returns all entries. + per_page + The number of entries per page to return. 25 maximum. + page + Which page of results to return + filter + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + + `Returns:` + A JSON with fundraising_page entry """ - return self.api.get_request(url=f"fundraising_pages/{fundraising_page_id}") - def get_fundraising_pages(self, limit=None, per_page=25, page=None, filter=None): + if page: + return self._get_page( + f"fundraising_pages/{fundraising_page_id}/donations", + page, + per_page, + filter, + ) + return self._get_entry_list( + f"fundraising_pages/{fundraising_page_id}/donations", + limit, + per_page, + filter, + ) + + def get_donation(self, donation_id): """ - `Args:` - limit: - The number of entries to return. When None, returns all entries. - per_page - The number of entries per page to return. 25 maximum. - page - Which page of results to return - filter - The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". - When None, no filter is applied. - - `Returns:` - A JSON with all the fundraising_pages entries - """ - if(page): - return self._get_page("fundraising_pages", page, per_page, filter) - return self._get_entry_list("fundraising_pages", limit,) + `Args:` + donation_id: The unique id of the donation + `Returns:` + A JSON with donation data + """ + return self.api.get_request(url=f"donations/{donation_id}") - def get_fundraising_page_donations(self,fundraising_page_id,limit=None, per_page=25, page=None, filter=None): + def get_donations(self, limit=None, per_page=25, page=None, filter=None): """ - `Args:` - fundraising_page_id: The id of the fundraiser - limit: - The number of entries to return. When None, returns all entries. - per_page - The number of entries per page to return. 25 maximum. - page - Which page of results to return - filter - The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". - When None, no filter is applied. + `Args:` + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + `Returns:` + A JSON with all the donations entries + """ + if page: + return self._get_page("donations", page, per_page, filter) + return self._get_entry_list("donations", limit, per_page, filter) - `Returns:` - A JSON with fundraising_page entry or an error + def get_forms(self, limit=None, per_page=25, page=None, filter=None): """ - if(page): - return self._get_page(f"fundraising_pages/{fundraising_page_id}/donations",page,per_page,filter) - return self._get_entry_list(f"fundraising_pages/{fundraising_page_id}/donations",limit,per_page,filter) + `Args:` + limit: + The number of entries to return. When None, returns all entries. + per_page + The number of entries per page to return. 25 maximum. + page + Which page of results to return + filter + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + `Returns:` + A JSON with all the forms entries + """ + if page: + return self._get_page("forms", page, per_page, filter) + return self._get_entry_list("forms", limit, per_page, filter) - def get_donation(self,donation_id): + def get_form(self, form_id): """ - `Args:` - donation_id: The unique id of the donation - `Returns:` - A JSON with donation data or an error + `Args:` + form_id: + The unique id of the form + `Returns:` + A JSON with form entry """ - return self.api.get_request(url=f"donations/{donation_id}") - def get_donations(self,limit=None, per_page=25, page=None, filter=None): - """ - `Args:` - limit: - The number of entries to return. When None, returns all entries. - per_page: - The number of entries per page to return. 25 maximum. - page: - Which page of results to return - filter: - The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". - When None, no filter is applied. - `Returns:` - A JSON with all the donations entries - """ - if (page): - return self._get_page(f"donations", page, per_page, filter) - return self._get_entry_list(f"donations", limit, per_page, filter) - - def get_forms(self,limit=None, per_page=25, page=None, filter=None): - """ - `Args:` - limit: - The number of entries to return. When None, returns all entries. - per_page - The number of entries per page to return. 25 maximum. - page - Which page of results to return - filter - The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". - When None, no filter is applied. - `Returns:` - A JSON with all the forms entries - """ - if (page): - return self._get_page(f"forms", page, per_page, filter) - return self._get_entry_list(f"forms", limit, per_page, filter) - - def get_form(self,form_id): - """ - `Args:` - form_id: - The unique id of the form - `Returns:` - A JSON with form entry - """ return self.api.get_request(f"forms/{form_id}") - def get_form_submissions(self, form_id, limit=None, per_page=25, page=None, filter=None): - """ - `Args:` - form_id: - The unique id of the form - limit: - The number of entries to return. When None, returns all entries. - per_page: - The number of entries per page to return. 25 maximum. - page: - Which page of results to return - filter: - The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". - When None, no filter is applied. - - `Returns:` - A JSON with all the submissions entries related to the form - """ - if (page): - return self._get_page(f"forms/{form_id}/submissions", page, per_page, filter) - return self._get_entry_list(f"forms/{form_id}/submissions", limit, per_page, filter) - - def get_person_submissions(self, person_id, limit=None, per_page=25, page=None, filter=None): - """ - `Args:` - person_id: - The unique id of the person - limit: - The number of entries to return. When None, returns all entries. - per_page: - The number of entries per page to return. 25 maximum. - page: - Which page of results to return - filter: - The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". - When None, no filter is applied. - `Returns:` - A JSON with all the submissions entries related with our group - """ - if (page): - return self._get_page(f"people/{person_id}/submissions", page, per_page, filter) - return self._get_entry_list(f"people/{person_id}/submissions", limit, per_page, filter) + + def get_form_submissions( + self, form_id, limit=None, per_page=25, page=None, filter=None + ): + """ + `Args:` + form_id: + The unique id of the form + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + + `Returns:` + A JSON with all the submissions entries related to the form + """ + if page: + return self._get_page( + f"forms/{form_id}/submissions", page, per_page, filter + ) + return self._get_entry_list( + f"forms/{form_id}/submissions", limit, per_page, filter + ) + + def get_person_submissions( + self, person_id, limit=None, per_page=25, page=None, filter=None + ): + """ + `Args:` + person_id: + The unique id of the person + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + `Returns:` + A JSON with all the submissions entries related with our group + """ + if page: + return self._get_page( + f"people/{person_id}/submissions", page, per_page, filter + ) + return self._get_entry_list( + f"people/{person_id}/submissions", limit, per_page, filter + ) def get_form_submission(self, form_id, submission_id): """ - `Args:` - form_id: - The unique id of the form - submission_id: - The unique id of the submission - `Returns:` - A JSON with the submission entry - """ + `Args:` + form_id: + The unique id of the form + submission_id: + The unique id of the submission + `Returns:` + A JSON with the submission entry + """ return self.api.get_request(f"forms/{form_id}/submissions/{submission_id}") def get_person_submission(self, person_id, submission_id): """ - `Args:` - person_id: - The unique id of the submission - submission_id: - The unique id of the submission - `Returns:` - A JSON with the submission entry - """ + `Args:` + person_id: + The unique id of the submission + submission_id: + The unique id of the submission + `Returns:` + A JSON with the submission entry + """ return self.api.get_request(f"people/{person_id}/submissions/{submission_id}") - def get_advocacy_campaigns(self,limit=None, per_page=25, page=None, filter=None): - """ - `Args:` - limit: - The number of entries to return. When None, returns all entries. - per_page: - The number of entries per page to return. 25 maximum. - page: - Which page of results to return - filter: - The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". - When None, no filter is applied. - - `Returns:` - A JSON with all of the advocacy_campaigns (letters) entries - """ - if (page): - return self._get_page(f"advocacy_campaigns", page, per_page, filter) - return self._get_entry_list(f"advocacy_campaigns", limit, per_page, filter) - def get_advocacy_campaign(self,advocacy_campaign_id): - """ - `Args:` - advocacy_campaign_id: - The unique id of the advocacy_campaign - `Returns:` - A JSON with advocacy_campaign entry - """ + def get_advocacy_campaigns(self, limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + + `Returns:` + A JSON with all of the advocacy_campaigns (letters) entries + """ + if page: + return self._get_page("advocacy_campaigns", page, per_page, filter) + return self._get_entry_list("advocacy_campaigns", limit, per_page, filter) + + def get_advocacy_campaign(self, advocacy_campaign_id): + """ + `Args:` + advocacy_campaign_id: + The unique id of the advocacy_campaign + `Returns:` + A JSON with advocacy_campaign entry + """ return self.api.get_request(f"advocacy_campaigns/{advocacy_campaign_id}") - def get_advocacy_campaign_outreaches(self,advocacy_campaign_id,limit=None, per_page=25, page=None, filter=None): - """ - `Args:` - advocacy_campaign_id: - The unique id of the advocacy_campaign - limit: - The number of entries to return. When None, returns all entries. - per_page: - The number of entries per page to return. 25 maximum. - page: - Which page of results to return - filter: - The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". - When None, no filter is applied. - - `Returns:` - A JSON with all the outreaches entries related to the advocacy_campaign_id - """ - if (page): - return self._get_page(f"advocacy_campaigns/{advocacy_campaign_id}/outreaches", page, per_page, filter) - return self._get_entry_list(f"advocacy_campaigns/{advocacy_campaign_id}/outreaches", limit, per_page, filter) - def get_person_outreaches(self,person_id, limit=None, per_page=25, page=None, filter=None): - """ - `Args:` - person_id: - The unique id of the person - limit: - The number of entries to return. When None, returns all entries. - per_page: - The number of entries per page to return. 25 maximum. - page: - Which page of results to return - filter: - The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". - When None, no filter is applied. - - `Returns:` - A JSON with all the outreaches entries related to our group - """ - if (page): - return self._get_page(f"people/{person_id}/outreaches", page, per_page, filter) - return self._get_entry_list(f"people/{person_id}/outreaches", limit, per_page, filter) - - def get_advocacy_campaign_outreach(self, advocacy_campaign_id , outreach_id): - """ - `Args:` - advocacy_campaign_id: - The uniqe id of the campaign - outreach_id: - The unique id of the outreach - `Returns:` - A JSON with the outreach entry - """ - return self.api.get_request(f"advocacy_campaigns/{advocacy_campaign_id}/outreaches/{outreach_id}") - - def get_campaigns(self,limit=None, per_page=25, page=None, filter=None): - """ - `Args:` - limit: - The number of entries to return. When None, returns all entries. - per_page: - The number of entries per page to return. 25 maximum. - page: - Which page of results to return - filter: - The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". - When None, no filter is applied. - `Returns:` - A JSON with all of the campaigns entries - """ - if (page): + + def get_advocacy_campaign_outreaches( + self, advocacy_campaign_id, limit=None, per_page=25, page=None, filter=None + ): + """ + `Args:` + advocacy_campaign_id: + The unique id of the advocacy_campaign + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + + `Returns:` + A JSON with all the outreaches entries related to the advocacy_campaign_id + """ + if page: + return self._get_page( + f"advocacy_campaigns/{advocacy_campaign_id}/outreaches", + page, + per_page, + filter, + ) + return self._get_entry_list( + f"advocacy_campaigns/{advocacy_campaign_id}/outreaches", + limit, + per_page, + filter, + ) + + def get_person_outreaches( + self, person_id, limit=None, per_page=25, page=None, filter=None + ): + """ + `Args:` + person_id: + The unique id of the person + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + + `Returns:` + A JSON with all the outreaches entries related to our group + """ + if page: + return self._get_page( + f"people/{person_id}/outreaches", page, per_page, filter + ) + return self._get_entry_list( + f"people/{person_id}/outreaches", limit, per_page, filter + ) + + def get_advocacy_campaign_outreach(self, advocacy_campaign_id, outreach_id): + """ + `Args:` + advocacy_campaign_id: + The uniqe id of the campaign + outreach_id: + The unique id of the outreach + `Returns:` + A JSON with the outreach entry + """ + return self.api.get_request( + f"advocacy_campaigns/{advocacy_campaign_id}/outreaches/{outreach_id}" + ) + + def get_campaigns(self, limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + `Returns:` + A JSON with all of the campaigns entries + """ + if page: return self._get_page("campaigns", page, per_page, filter) return self._get_entry_list("campaigns", limit, per_page, filter) - def get_campaign(self,campaign_id): - """ - `Args:` - campaign_id: - The unique id of the campaign - `Returns:` - A JSON with the campaign entry - """ + + def get_campaign(self, campaign_id): + """ + `Args:` + campaign_id: + The unique id of the campaign + `Returns:` + A JSON with the campaign entry + """ return self.api.get_request(f"campaigns/{campaign_id}") - def get_event_campaigns(self,limit=None, per_page=25, page=None, filter=None): - """ - `Args:` - limit: - The number of entries to return. When None, returns all entries. - per_page: - The number of entries per page to return. 25 maximum. - page: - Which page of results to return - filter: - The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". - When None, no filter is applied. - `Returns:` - A JSON with all the event_campaigns entries - """ - if (page): + + def get_event_campaigns(self, limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + `Returns:` + A JSON with all the event_campaigns entries + """ + if page: return self._get_page("event_campaigns", page, per_page, filter) return self._get_entry_list("event_campaigns", limit, per_page, filter) - def get_event_campaign(self,event_campaign_id): + def get_event_campaign(self, event_campaign_id): + """ + `Args:` + event_campaign_id: + The unique id of the event_campaign + `Returns:` + A JSON with event_campaign entry """ - `Args:` - event_campaign_id: - The unique id of the event_campaign - `Returns:` - A JSON with event_campaign entry - """ return self.api.get_request(f"event_campaigns/{event_campaign_id}") - def get_event_campaign_events(self,event_campaign_id): - """ - `Args:` - event_campaign_id: - The unique id of the event_campaign - `Returns:` - A JSON with all the eventes related to the event_campaign entry - """ + + def get_event_campaign_events(self, event_campaign_id): + """ + `Args:` + event_campaign_id: + The unique id of the event_campaign + `Returns:` + A JSON with all the eventes related to the event_campaign entry + """ return self.api.get_request(f"event_campaigns/{event_campaign_id}/events") - def get_person_attendances(self,person_id,limit=None, per_page=25, page=None, filter=None): - """ - `Args:` - person_id: - The unique id of the person - limit: - The number of entries to return. When None, returns all entries. - per_page: - The number of entries per page to return. 25 maximum. - page: - Which page of results to return - filter: - The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". - When None, no filter is applied. - `Returns:` - A JSON with all the attendances entries - """ - if (page): - return self._get_page(f"people/{person_id}/attendances", page, per_page, filter) - return self._get_entry_list(f"people/{person_id}/attendances", limit, per_page, filter) - - - def get_event_attendance(self,event_id,attendance_id): - """ - `Args:` - event_id: - The unique id of the event - attendance_id: - The unique id of the attendance - `Returns:` - A JSON with the attendance entry - """ + + def get_person_attendances( + self, person_id, limit=None, per_page=25, page=None, filter=None + ): + """ + `Args:` + person_id: + The unique id of the person + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + `Returns:` + A JSON with all the attendances entries + """ + if page: + return self._get_page( + f"people/{person_id}/attendances", page, per_page, filter + ) + return self._get_entry_list( + f"people/{person_id}/attendances", limit, per_page, filter + ) + + def get_event_attendance(self, event_id, attendance_id): + """ + `Args:` + event_id: + The unique id of the event + attendance_id: + The unique id of the attendance + `Returns:` + A JSON with the attendance entry + """ return self.api.get_request(f"events/{event_id}/attendances/{attendance_id}") - def get_person_attendance(self,person_id,attendance_id): - """ - `Args:` - person_id: - The unique id of the person - attendance_id: - The unique id of the attendance - `Returns:` - A JSON with the attendance entry - """ + + def get_person_attendance(self, person_id, attendance_id): + """ + `Args:` + person_id: + The unique id of the person + attendance_id: + The unique id of the attendance + `Returns:` + A JSON with the attendance entry + """ return self.api.get_request(f"people/{person_id}/attendances/{attendance_id}") - def get_petitions(self,limit=None, per_page=25, page=None, filter=None): - """ - `Args:` - limit: - The number of entries to return. When None, returns all entries. - per_page: - The number of entries per page to return. 25 maximum. - page: - Which page of results to return - filter: - The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". - When None, no filter is applied. - `Returns:` - A JSON with all of the petitions entries - """ - if (page): - return self._get_page(f"petitions", page, per_page, filter) - return self._get_entry_list(f"petitions", limit, per_page, filter) - - def get_petition(self,petition_id): - """ - `Args:` - petition_id: - The unique id of the petition - `Returns:` - A JSON with the petition entry - """ + def get_petitions(self, limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + `Returns:` + A JSON with all of the petitions entries + """ + if page: + return self._get_page("petitions", page, per_page, filter) + return self._get_entry_list("petitions", limit, per_page, filter) + + def get_petition(self, petition_id): + """ + `Args:` + petition_id: + The unique id of the petition + `Returns:` + A JSON with the petition entry + """ return self.api.get_request(f"petitions/{petition_id}") - def get_petition_signatures(self,petition_id,limit=None, per_page=25, page=None, filter=None): - """ - `Args:` - petition_id: - The unique id of the petition - limit: - The number of entries to return. When None, returns all entries. - per_page: - The number of entries per page to return. 25 maximum. - page: - Which page of results to return - filter: - The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". - When None, no filter is applied. - `Returns:` - A JSON with all the signatures related to the petition entry - """ - if (page): - return self._get_page(f"petitions/{petition_id}/signatures", page, per_page, filter) - return self._get_entry_list(f"petitions/{petition_id}/signatures", limit, per_page, filter) - def get_person_signatures(self,person_id,limit=None, per_page=25, page=None, filter=None): - """ - `Args:` - person_id: - The unique id of the person - limit: - The number of entries to return. When None, returns all entries. - per_page: - The number of entries per page to return. 25 maximum. - page: - Which page of results to return - filter: - The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". - When None, no filter is applied. - - - `Returns:` - A JSON with all the signatures related to the petition entry - """ - if (page): - return self._get_page(f"people/{person_id}/signatures", page, per_page, filter) - return self._get_entry_list(f"people/{person_id}/signatures", limit, per_page, filter) - - def get_petition_signature(self,petition_id,signature_id): - """ - `Args:` - petition_id: - The unique id of the petition - signature_id: - The unique id of the signature - `Returns:` - A JSON with the signature entry - """ - return self.api.get_request(f"petitions/{petition_id}/signatures/{signature_id}") - def get_person_signature(self,person_id,signature_id): - """ - `Args:` - person_id: - The unique id of the person - signature_id: - The unique id of the signature - `Returns:` - A JSON with the signature entry - """ + + def get_petition_signatures( + self, petition_id, limit=None, per_page=25, page=None, filter=None + ): + """ + `Args:` + petition_id: + The unique id of the petition + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + `Returns:` + A JSON with all the signatures related to the petition entry + """ + if page: + return self._get_page( + f"petitions/{petition_id}/signatures", page, per_page, filter + ) + return self._get_entry_list( + f"petitions/{petition_id}/signatures", limit, per_page, filter + ) + + def get_person_signatures( + self, person_id, limit=None, per_page=25, page=None, filter=None + ): + """ + `Args:` + person_id: + The unique id of the person + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + + + `Returns:` + A JSON with all the signatures related to the petition entry + """ + if page: + return self._get_page( + f"people/{person_id}/signatures", page, per_page, filter + ) + return self._get_entry_list( + f"people/{person_id}/signatures", limit, per_page, filter + ) + + def get_petition_signature(self, petition_id, signature_id): + """ + `Args:` + petition_id: + The unique id of the petition + signature_id: + The unique id of the signature + `Returns:` + A JSON with the signature entry + """ + return self.api.get_request( + f"petitions/{petition_id}/signatures/{signature_id}" + ) + + def get_person_signature(self, person_id, signature_id): + """ + `Args:` + person_id: + The unique id of the person + signature_id: + The unique id of the signature + `Returns:` + A JSON with the signature entry + """ return self.api.get_request(f"people/{person_id}/signatures/{signature_id}") diff --git a/test/test_action_network/test_action_network.py b/test/test_action_network/test_action_network.py index c57ffd359f..1c17815e3f 100644 --- a/test/test_action_network/test_action_network.py +++ b/test/test_action_network/test_action_network.py @@ -1,10 +1,13 @@ +import logging import unittest + +import requests import requests_mock import json +import os from parsons import Table, ActionNetwork from test.utils import assert_matching_tables - class TestActionNetwork(unittest.TestCase): @requests_mock.Mocker() def setUp(self, m): @@ -559,11 +562,13 @@ def test_filter_on_get_unsupported_entry(self, m): ) @requests_mock.Mocker() - def test_get_fundraising_pages(self, m): + def test_get_fundraising_pages(self,m): m.get( f"{self.api_url}/fundraising_pages", text=json.dumps(self.fake_fundraising_pages), ) + assert_matching_tables( self.an._get_entry_list("fundraising_pages", 1, 1), self.fake_fundraising_pages["_embedded"]["osdi:fundraising_pages"]) + From 4369c13a454158e36e0692b7fd48cc9284ccbebf Mon Sep 17 00:00:00 2001 From: NirTatcher Date: Sun, 1 Oct 2023 13:29:23 +0300 Subject: [PATCH 05/10] linting and black formatted compliance --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8b1ee6b888..afb385c474 100644 --- a/.gitignore +++ b/.gitignore @@ -84,7 +84,7 @@ celerybeat-schedule # Environments .env -.venv +.venv* env/ venv/ ENV/ From bd1d67719b4c9e01179538dd535b89b3a7cf1b15 Mon Sep 17 00:00:00 2001 From: NirTatcher Date: Mon, 2 Oct 2023 17:57:24 +0300 Subject: [PATCH 06/10] removed unwanted/unsused lines --- test/test_action_network/test_action_network.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/test_action_network/test_action_network.py b/test/test_action_network/test_action_network.py index 1c17815e3f..d1ad4641e1 100644 --- a/test/test_action_network/test_action_network.py +++ b/test/test_action_network/test_action_network.py @@ -1,10 +1,6 @@ -import logging import unittest - -import requests import requests_mock import json -import os from parsons import Table, ActionNetwork from test.utils import assert_matching_tables From 3d936447fee42dcaae54aebe4308b2376d70bf4a Mon Sep 17 00:00:00 2001 From: NirTatcher Date: Mon, 2 Oct 2023 18:04:58 +0300 Subject: [PATCH 07/10] merged updated main --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index afb385c474..99a87cf379 100644 --- a/.gitignore +++ b/.gitignore @@ -86,7 +86,7 @@ celerybeat-schedule .env .venv* env/ -venv/ +venv*/ ENV/ env.bak/ venv.bak/ From 2fefee102ff349ff67482cbb886f94e8bfb4baa8 Mon Sep 17 00:00:00 2001 From: NirTatcher Date: Tue, 17 Oct 2023 13:57:40 +0300 Subject: [PATCH 08/10] did some linting --- parsons/facebook_ads/facebook_ads.py | 2 +- test/test_action_network/test_action_network.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/parsons/facebook_ads/facebook_ads.py b/parsons/facebook_ads/facebook_ads.py index c7e9eb826a..0733cfed8b 100644 --- a/parsons/facebook_ads/facebook_ads.py +++ b/parsons/facebook_ads/facebook_ads.py @@ -390,7 +390,7 @@ def add_users_to_custom_audience(self, audience_id, users_table): self.access_token, audience_id, schema, - data[i: i + batch_size], + data[i : i + batch_size], i, num_rows, ) diff --git a/test/test_action_network/test_action_network.py b/test/test_action_network/test_action_network.py index d1ad4641e1..ca6c866874 100644 --- a/test/test_action_network/test_action_network.py +++ b/test/test_action_network/test_action_network.py @@ -4,7 +4,9 @@ from parsons import Table, ActionNetwork from test.utils import assert_matching_tables + class TestActionNetwork(unittest.TestCase): + @requests_mock.Mocker() def setUp(self, m): @@ -558,7 +560,7 @@ def test_filter_on_get_unsupported_entry(self, m): ) @requests_mock.Mocker() - def test_get_fundraising_pages(self,m): + def test_get_fundraising_pages(self, m): m.get( f"{self.api_url}/fundraising_pages", text=json.dumps(self.fake_fundraising_pages), @@ -567,4 +569,3 @@ def test_get_fundraising_pages(self,m): assert_matching_tables( self.an._get_entry_list("fundraising_pages", 1, 1), self.fake_fundraising_pages["_embedded"]["osdi:fundraising_pages"]) - From 2d286964473515cd58bfedfa2198f8d2f2d16d72 Mon Sep 17 00:00:00 2001 From: NirTatcher Date: Sun, 22 Oct 2023 14:26:09 +0300 Subject: [PATCH 09/10] added some more get functions to support all ActionNetwork objects (Advocacy Campaigns, Attendances, Campaigns, Custom Fields, Donations, Embeds, Event Campaigns, Events, Forms, Fundraising Pages, Items, Lists, Messages, Metadata, Outreaches, People, Petitions, Queries, Signatures, Submissions, Tags, Taggings, Wrappers) --- parsons/action_network/action_network.py | 226 ++++++++++++++++++ .../test_action_network.py | 35 +-- test/test_databases/fakes.py | 4 +- 3 files changed, 238 insertions(+), 27 deletions(-) diff --git a/parsons/action_network/action_network.py b/parsons/action_network/action_network.py index 78e64a1e82..891bb09843 100644 --- a/parsons/action_network/action_network.py +++ b/parsons/action_network/action_network.py @@ -1018,3 +1018,229 @@ def get_person_signature(self, person_id, signature_id): A JSON with the signature entry """ return self.api.get_request(f"people/{person_id}/signatures/{signature_id}") + + def get_messages(self, limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + + + `Returns:` + A JSON with all the messages related entries + """ + if page: + return self._get_page("messages", page, per_page, filter) + return self._get_entry_list("messages", limit, per_page, filter) + + def get_message(self, message_id): + """ + `Args:` + message_id: + The unique id of the message + `Returns:` + A JSON with the signature entry. + """ + return self.api.get_request(f"messages/{message_id}") + + def get_custom_fields(self): + """ + `Args:` + None + `Returns:` + A JSON with the custom_fields associated with your API key. + """ + return self.api.get_request("metadata/custom_fields") + + def get_embeds(self, action_type, action_id): + """ + `Args:` + action_type: + The action type (petition, events, etc.) + action_id: + The unique id of the action + `Returns:` + A JSON with the embeds (for you to be able to embed action outside of ActionNetwork). + """ + return self.api.get_request(f"{action_type}/{action_id}/embed") + + def get_items(self, list_id, limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + list_id: + The unique id of the list + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + + + `Returns:` + A JSON with all the list item entries + """ + if page: + return self._get_page(f"lists/{list_id}/items", page, per_page, filter) + return self._get_entry_list(f"lists/{list_id}/items", limit, per_page, filter) + + def get_item(self, list_id, item_id): + """ + `Args:` + list_id: + The unique id of the list + item_id: + The unique id of the item + `Returns:` + A JSON with the item entry + """ + return self.api.get_request(f"lists/{list_id}/items/{item_id}") + + def get_lists(self, limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + + + `Returns:` + A JSON with all the list entries + """ + if page: + return self._get_page("lists", page, per_page, filter) + return self._get_entry_list("lists", limit, per_page, filter) + + def get_list(self, list_id): + """ + `Args:` + list_id: + The unique id of the list + `Returns:` + A JSON with the list entry + """ + return self.api.get_request(f"lists/{list_id}") + + def get_metadata(self): + """ + `Args:` + None + `Returns:` + A JSON with the metadata entry + """ + return self.api.get_request("metadata") + + def get_queries(self, limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + + + `Returns:` + A JSON with all the query entries + """ + if page: + return self._get_page("queries", page, per_page, filter) + return self._get_entry_list("queries", limit, per_page, filter) + + def get_query(self, query_id): + """ + `Args:` + query_id: + The unique id of the query + `Returns:` + A JSON with the query entry + """ + return self.api.get_request(f"queries/{query_id}") + + def get_taggings(self, tag_id, limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + tag_id: + The unique id of the tag + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + + + `Returns:` + A JSON with all the tagging entries associated with the tag_id + """ + if page: + return self._get_page(f"tags/{tag_id}/taggings", page, per_page, filter) + return self._get_entry_list(f"tag/{tag_id}/taggings", limit, per_page, filter) + + def get_tagging(self, tag_id, tagging_id): + """ + `Args:` + tag_id: + The unique id of the tag + tagging_id: + The unique id of the tagging + `Returns:` + A JSON with the tagging entry + """ + return self.api.get_request(f"tag/{tag_id}/taggings/{tagging_id}") + + def get_wrappers(self, limit=None, per_page=25, page=None, filter=None): + """ + `Args:` + limit: + The number of entries to return. When None, returns all entries. + per_page: + The number of entries per page to return. 25 maximum. + page: + Which page of results to return + filter: + The OData query for filtering results. E.g. "modified_date gt '2014-03-25'". + When None, no filter is applied. + + + `Returns:` + A JSON with all the wrapper entries + """ + if page: + return self._get_page("wrappers", page, per_page, filter) + return self._get_entry_list("wrappers", limit, per_page, filter) + + def get_wrapper(self, wrapper_id): + """ + `Args:` + wrapper_id: + The unique id of the wrapper + tagging_id: + The unique id of the tagging + `Returns:` + A JSON with the wrapper entry + """ + return self.api.get_request(f"wrappers/{wrapper_id}") diff --git a/test/test_action_network/test_action_network.py b/test/test_action_network/test_action_network.py index ca6c866874..47f43ac1d3 100644 --- a/test/test_action_network/test_action_network.py +++ b/test/test_action_network/test_action_network.py @@ -6,7 +6,6 @@ class TestActionNetwork(unittest.TestCase): - @requests_mock.Mocker() def setUp(self, m): @@ -368,38 +367,23 @@ def setUp(self, m): "_embedded": { "osdi:fundraising_pages": [ { - "identifiers": [ - "" - ], + "identifiers": [""], "created_date": self.fake_date, "total_donations": 0, "total_amount": "0.00", "currency": "USD", - "action_network:sponsor": { - "title": "", - "browser_url": "" - }, + "action_network:sponsor": {"title": "", "browser_url": ""}, "_links": { - "self": { - "href": f"{self.api_url}/fundraising_pages" - }, - "osdi:creator": { - "href": "fake_url" - }, - "osdi:donations": { - "href": "fake_url" - }, - "osdi:record_donation_helper": { - "href": "fake_url" - } + "self": {"href": f"{self.api_url}/fundraising_pages"}, + "osdi:creator": {"href": "fake_url"}, + "osdi:donations": {"href": "fake_url"}, + "osdi:record_donation_helper": {"href": "fake_url"}, }, "modified_date": self.fake_date, "origin_system": "Test", "title": "Hello", - "_embedded": { - "osdi:creator": "" - }, - "action_network:hidden": False + "_embedded": {"osdi:creator": ""}, + "action_network:hidden": False, } ] }, @@ -568,4 +552,5 @@ def test_get_fundraising_pages(self, m): assert_matching_tables( self.an._get_entry_list("fundraising_pages", 1, 1), - self.fake_fundraising_pages["_embedded"]["osdi:fundraising_pages"]) + self.fake_fundraising_pages["_embedded"]["osdi:fundraising_pages"], + ) diff --git a/test/test_databases/fakes.py b/test/test_databases/fakes.py index 97ff05c668..049bba960b 100644 --- a/test/test_databases/fakes.py +++ b/test/test_databases/fakes.py @@ -98,7 +98,7 @@ def get_rows(self, offset=0, chunk_size=None, order_by=None): if order_by: data.sort(order_by) - return Table(data[offset: chunk_size + offset]) + return Table(data[offset : chunk_size + offset]) def get_new_rows_count(self, primary_key_col, start_value=None): data = self.data.select_rows(lambda row: row[primary_key_col] > start_value) @@ -108,4 +108,4 @@ def get_new_rows(self, primary_key, cutoff_value, offset=0, chunk_size=None): data = self.data.select_rows(lambda row: row[primary_key] > cutoff_value) data.sort(primary_key) - return Table(data[offset: chunk_size + offset]) + return Table(data[offset : chunk_size + offset]) From 113ed48a3bb5d670b603d35d02e348f6302f1fcb Mon Sep 17 00:00:00 2001 From: NirTatcher Date: Thu, 26 Oct 2023 17:10:01 +0300 Subject: [PATCH 10/10] worked on linting again --- .../test_action_network.py | 1408 +++++++---------- 1 file changed, 567 insertions(+), 841 deletions(-) diff --git a/test/test_action_network/test_action_network.py b/test/test_action_network/test_action_network.py index 39d8675edd..4387afc006 100644 --- a/test/test_action_network/test_action_network.py +++ b/test/test_action_network/test_action_network.py @@ -344,7 +344,7 @@ def setUp(self, m): "start_date": self.fake_date, "location": self.fake_location, "_links": { - "self": {"href": "https://actionnetwork.org/api/v2/events/fake-id"}, + "self": {"href": f"{self.api_url}/events/fake-id"}, }, "event_id": "fake-id", } @@ -356,17 +356,11 @@ def setUp(self, m): "page": 1, "total_records": 3, "_links": { - "next": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns?page=2" - }, - "self": {"href": "https://actionnetwork.org/api/v2/advocacy_campaigns"}, + "next": {"href": f"{self.api_url}/advocacy_campaigns?page=2"}, + "self": {"href": f"{self.api_url}/advocacy_campaigns"}, "osdi:advocacy_campaigns": [ - { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/65345d7d-cd24-466a-a698-4a7686ef684f" - }, - { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/adb951cb-51f9-420e-b7e6-de953195ec86" - }, + {"href": f"{self.api_url}/advocacy_campaigns/fake_url"}, + {"href": f"{self.api_url}/advocacy_campaigns/fake_url"}, ], "curies": [ { @@ -400,9 +394,7 @@ def setUp(self, m): "osdi:creator": { "given_name": "John", "family_name": "Doe", - "identifiers": [ - "action_network:c945d6fe-929e-11e3-a2e9-12313d316c29" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", "email_addresses": [ @@ -438,52 +430,46 @@ def setUp(self, m): ], "languages_spoken": ["en"], "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" - }, + "self": {"href": f"{self.api_url}/people/fake_url"}, "osdi:attendances": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/attendances" + "href": f"{self.api_url}/people/fake_url" }, "osdi:signatures": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/signatures" + "href": f"{self.api_url}/people/fake_url" }, "osdi:submissions": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/submissions" + "href": f"{self.api_url}/people/fake_url" }, "osdi:donations": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/donations" + "href": f"{self.api_url}/people/fake_url" }, "osdi:outreaches": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/outreaches" + "href": f"{self.api_url}/people/fake_url" }, "osdi:taggings": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/taggings" + "href": f"{self.api_url}/people/fake_url" }, }, } }, "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/65345d7d-cd24-466a-a698-4a7686ef684f" + "href": f"{self.api_url}/advocacy_campaigns/fake_url" }, "osdi:outreaches": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/65345d7d-cd24-466a-a698-4a7686ef684f/outreaches" + "href": f"{self.api_url}/advocacy_campaigns/fake_url" }, "osdi:record_outreach_helper": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/65345d7d-cd24-466a-a698-4a7686ef684f/outreaches" - }, - "osdi:creator": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/advocacy_campaigns/fake_url" }, + "osdi:creator": {"href": f"{self.api_url}/people/fake_url"}, "action_network:embed": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/65345d7d-cd24-466a-a698-4a7686ef684f/embed" + "href": f"{self.api_url}/advocacy_campaigns/fake_url" }, }, }, { - "identifiers": [ - "action_network:adb951cb-51f9-420e-b7e6-de953195ec86" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-21T23:39:53Z", "modified_date": "2014-03-25T15:26:45Z", "title": "Thank Acme's CEO for going green", @@ -498,9 +484,7 @@ def setUp(self, m): "osdi:creator": { "given_name": "John", "family_name": "Doe", - "identifiers": [ - "action_network:c945d6fe-929e-11e3-a2e9-12313d316c29" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", "email_addresses": [ @@ -536,45 +520,41 @@ def setUp(self, m): ], "languages_spoken": ["en"], "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" - }, + "self": {"href": f"{self.api_url}/people/fake_url"}, "osdi:attendances": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/attendances" + "href": f"{self.api_url}/people/fake_url" }, "osdi:signatures": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/signatures" + "href": f"{self.api_url}/people/fake_url" }, "osdi:submissions": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/submissions" + "href": f"{self.api_url}/people/fake_url" }, "osdi:donations": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/donations" + "href": f"{self.api_url}/people/fake_url" }, "osdi:outreaches": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/outreaches" + "href": f"{self.api_url}/people/fake_url" }, "osdi:taggings": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/taggings" + "href": f"{self.api_url}/people/fake_url" }, }, } }, "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/adb951cb-51f9-420e-b7e6-de953195ec86" + "href": f"{self.api_url}/advocacy_campaigns/fake_url" }, "osdi:outreaches": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/adb951cb-51f9-420e-b7e6-de953195ec86/outreaches" + "href": f"{self.api_url}/advocacy_campaigns/fake_url" }, "osdi:record_outreach_helper": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/adb951cb-51f9-420e-b7e6-de953195ec86/outreaches" - }, - "osdi:creator": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/advocacy_campaigns/fake_url" }, + "osdi:creator": {"href": f"{self.api_url}/people/fake_id"}, "action_network:embed": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/adb951cb-51f9-420e-b7e6-de953195ec86/embed" + "href": f"{self.api_url}/advocacy_campaigns/fake_url" }, }, }, @@ -605,16 +585,14 @@ def setUp(self, m): }, ], "self": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/44618be7-29cb-439e-bc68-70e6e85dda1b" + "href": f"{self.api_url}/advocacy_campaigns/fake_url" }, "osdi:outreaches": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/44618be7-29cb-439e-bc68-70e6e85dda1b/outreaches" - }, - "osdi:creator": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/advocacy_campaigns/fake_url" }, + "osdi:creator": {"href": f"{self.api_url}/people/fake_url"}, "osdi:record_outreach_helper": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/44618be7-29cb-439e-bc68-70e6e85dda1b/outreaches" + "href": f"{self.api_url}/advocacy_campaigns/fake_url" }, }, }, @@ -622,7 +600,7 @@ def setUp(self, m): }, } self.fake_advocacy_campaign = { - "identifiers": ["action_network:adb951cb-51f9-420e-b7e6-de953195ec86"], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-21T23:39:53Z", "modified_date": "2014-03-25T15:26:45Z", "title": "Thank Acme's CEO for going green", @@ -637,9 +615,7 @@ def setUp(self, m): "osdi:creator": { "given_name": "John", "family_name": "Doe", - "identifiers": [ - "action_network:c945d6fe-929e-11e3-a2e9-12313d316c29" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", "email_addresses": [ @@ -675,26 +651,24 @@ def setUp(self, m): ], "languages_spoken": ["en"], "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" - }, + "self": {"href": f"{self.api_url}/people/fake_id"}, "osdi:attendances": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/attendances" + "href": f"{self.api_url}/people/fake_id/attendances" }, "osdi:signatures": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/signatures" + "href": f"{self.api_url}/people/fake_id/signatures" }, "osdi:submissions": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/submissions" + "href": f"{self.api_url}/people/fake_id/submissions" }, "osdi:donations": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/donations" + "href": f"{self.api_url}/people/fake_id/donations" }, "osdi:outreaches": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/outreaches" + "href": f"{self.api_url}/people/fake_id/outreaches" }, "osdi:taggings": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/taggings" + "href": f"{self.api_url}/people/fake_id/taggings" }, "curies": [ { @@ -712,20 +686,16 @@ def setUp(self, m): } }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/adb951cb-51f9-420e-b7e6-de953195ec86" - }, + "self": {"href": f"{self.api_url}/advocacy_campaigns/fake_id"}, "osdi:outreaches": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/adb951cb-51f9-420e-b7e6-de953195ec86/outreaches" + "href": f"{self.api_url}/advocacy_campaigns/fake_id/outreaches" }, "osdi:record_outreach_helper": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/adb951cb-51f9-420e-b7e6-de953195ec86/outreaches" - }, - "osdi:creator": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/advocacy_campaigns/fake_id/outreaches" }, + "osdi:creator": {"href": f"{self.api_url}/people/fake_id"}, "action_network:embed": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/adb951cb-51f9-420e-b7e6-de953195ec86/embed" + "href": f"{self.api_url}/advocacy_campaigns/fake_id/embed" }, "curies": [ { @@ -749,16 +719,10 @@ def setUp(self, m): "page": 1, "total_records": 20, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/events/12c9a105-1ab6-472e-ac04-667c521a5968/attendances" - }, + "self": {"href": f"{self.api_url}/events/fake_id/attendances"}, "osdi:attendance": [ - { - "href": "https://actionnetwork.org/api/v2/events/12c9a105-1ab6-472e-ac04-667c521a5968/attendances/d51ca19e-9fe9-11e3-a2e9-12313d316c29" - }, - { - "href": "https://actionnetwork.org/api/v2/events/12c9a105-1ab6-472e-ac04-667c521a5968/attendances/d51c9b4a-9fe9-11e3-a2e9-12313d316c29" - }, + {"href": f"{self.api_url}/events/fake_id/attendances/fake_id"}, + {"href": f"{self.api_url}/events/fake_id/attendances/fake_id"}, ], "curies": [ { @@ -782,39 +746,29 @@ def setUp(self, m): "created_date": "2014-02-18T20:52:59Z", "modified_date": "2014-02-18T20:53:00Z", "status": "accepted", - "action_network:person_id": "ceef7e23-4617-4af8-bd0f-60029299d8cd", - "action_network:event_id": "12c9a105-1ab6-472e-ac04-667c521a5968", + "action_network:person_id": "fake_id", + "action_network:event_id": "fake_id", "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/events/12c9a105-1ab6-472e-ac04-667c521a5968/attendances/d51ca19e-9fe9-11e3-a2e9-12313d316c29" - }, - "osdi:event": { - "href": "https://actionnetwork.org/api/v2/events/12c9a105-1ab6-472e-ac04-667c521a5968" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/ceef7e23-4617-4af8-bd0f-60029299d8cd" + "href": f"{self.api_url}/events/fake_id/attendances/fake_id" }, + "osdi:event": {"href": f"{self.api_url}/events/fake_id"}, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, }, }, { - "identifiers": [ - "action_network:d51c9b4a-9fe9-11e3-a2e9-12313d316c29" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-02-18T20:23:42Z", "modified_date": "2014-02-18T20:23:42Z", "status": "accepted", - "action_network:person_id": "06d13a33-6824-493b-a922-95e793f269d3", - "action_network:event_id": "12c9a105-1ab6-472e-ac04-667c521a5968", + "action_network:person_id": "fake_id", + "action_network:event_id": "fake_id", "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/events/12c9a105-1ab6-472e-ac04-667c521a5968/attendances/d51c9b4a-9fe9-11e3-a2e9-12313d316c29" - }, - "osdi:event": { - "href": "https://actionnetwork.org/api/v2/events/12c9a105-1ab6-472e-ac04-667c521a5968" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/06d13a33-6824-493b-a922-95e793f269d3" + "href": f"{self.api_url}/events/fake_id/attendances/fake_id" }, + "osdi:event": {"href": f"{self.api_url}/events/fake_id"}, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, }, }, ] @@ -825,18 +779,12 @@ def setUp(self, m): "created_date": "2014-02-18T20:52:59Z", "modified_date": "2014-02-18T20:53:00Z", "status": "accepted", - "action_network:person_id": "ceef7e23-4617-4af8-bd0f-60029299d8cd", - "action_network:event_id": "12c9a105-1ab6-472e-ac04-667c521a5968", + "action_network:person_id": "fake_id", + "action_network:event_id": "fake_id", "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/events/12c9a105-1ab6-472e-ac04-667c521a5968/attendances/d51ca19e-9fe9-11e3-a2e9-12313d316c29" - }, - "osdi:event": { - "href": "https://actionnetwork.org/api/v2/events/12c9a105-1ab6-472e-ac04-667c521a5968" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/ceef7e23-4617-4af8-bd0f-60029299d8cd" - }, + "self": {"href": f"{self.api_url}/events/fake_id/attendances/fake_id"}, + "osdi:event": {"href": f"{self.api_url}/events/fake_id"}, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, "curies": [ { "name": "osdi", @@ -859,15 +807,11 @@ def setUp(self, m): "page": 1, "total_records": 30, "_links": { - "next": {"href": "https://actionnetwork.org/api/v2/campaigns?page=2"}, - "self": {"href": "https://actionnetwork.org/api/v2/campaigns"}, + "next": {"href": f"{self.api_url}/campaigns?page=2"}, + "self": {"href": f"{self.api_url}/campaigns"}, "action_network:campaigns": [ - { - "href": "https://actionnetwork.org/api/v2/campaigns/e7b02e0a-a0a9-11e3-a2e9-12313d316c29" - }, - { - "href": "https://actionnetwork.org/api/v2/campaigns/e7b0287e-a0a9-11e3-a2e9-12313d316c29" - }, + {"href": f"{self.api_url}/campaigns/fake_id"}, + {"href": f"{self.api_url}/campaigns/fake_id"}, ], "curies": [ { @@ -885,77 +829,72 @@ def setUp(self, m): "_embedded": { "action_network:campaigns": [ { - "identifiers": [ - "action_network:e7b02e0a-a0a9-11e3-a2e9-12313d316c29" - ], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2013-10-02T14:21:32Z", "modified_date": "2013-10-02T14:22:06Z", "title": "Join our week of actions!", - "description": "

Our week of action is here -- click the links on the right to join in!

", - "browser_url": "https://actionnetwork.org/campaigns/join-our-week-of-action", - "featured_image_url": "https://actionnetwork.org/images/week-of-action.jpg", + "description": "

Our week of action is here --" + "click the links on the right to join in!

", + "browser_url": "fake_url", + "featured_image_url": "fake_url", "action_network:hidden": False, "action_network:sponsor": { "title": "Progressive Action Now", - "browser_url": "https://actionnetwork.org/groups/progressive-action-now", + "browser_url": "fake_url", }, "actions": [ { "title": "Sign the petition", - "browser_url": "https://actionnetwork.org/petitions/sign-the-petition", + "browser_url": "fake_url", }, { "title": "Attend the rally", - "browser_url": "https://actionnetwork.org/events/attend-the-rally", + "browser_url": "fake_url", }, ], "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/campaigns/e7b02e0a-a0a9-11e3-a2e9-12313d316c29" - } + "self": {"href": f"{self.api_url}/campaigns/fake_id"} }, }, { - "identifiers": [ - "action_network:e7b0287e-a0a9-11e3-a2e9-12313d316c29" - ], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2013-09-30T15:55:44Z", "modified_date": "2014-01-16T19:07:00Z", "title": "Welcome to our Action Center", - "description": "

Welcome to our Action Center. Take action on the right.

", - "browser_url": "https://actionnetwork.org/campaigns/welcome-to-our-action-center", + "description": "

Welcome to our Action Center." + "Take action on the right.

", + "browser_url": "fake_url", "action_network:sponsor": { "title": "Progressive Action Now", - "browser_url": "https://actionnetwork.org/groups/progressive-action-now", + "browser_url": "fake_url", }, "actions": [ { "title": "Sign up for email updates", - "browser_url": "https://actionnetwork.org/forms/sign-up-for-email-updates", + "browser_url": "fake_url", }, { "title": "Take our survey", - "browser_url": "https://actionnetwork.org/forms/take-our-survey", + "browser_url": "fake_url", }, ], "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/campaigns/e7b0287e-a0a9-11e3-a2e9-12313d316c29" - } + "self": {"href": f"{self.api_url}/campaigns/fake_id"} }, }, ] }, } self.fake_campaign = { - "identifiers": ["action_network:e7b02e0a-a0a9-11e3-a2e9-12313d316c29"], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2013-10-02T14:21:32Z", "modified_date": "2013-10-02T14:22:06Z", "title": "Join our week of actions!", - "description": "

Our week of action is here -- click the links on the right to join in!

", + "description": "

Our week of action is here --" + "click the links on the right to join in!

", "browser_url": "https://actionnetwork.org/campaigns/join-our-week-of-action", "featured_image_url": "https://actionnetwork.org/images/week-of-action.jpg", "action_network:hidden": False, @@ -974,9 +913,7 @@ def setUp(self, m): }, ], "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/campaigns/e7b02e0a-a0a9-11e3-a2e9-12313d316c29" - }, + "self": {"href": f"{self.api_url}/campaigns/fake_id"}, "curies": [ { "name": "osdi", @@ -1051,15 +988,13 @@ def setUp(self, m): "page": 1, "total_records": 6, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/fundraising_pages/049e9bda-cb79-420d-91ba-92e5a15ba62f/donations" - }, + "self": {"href": f"{self.api_url}/fundraising_pages/fake_id/donations"}, "osdi:donations": [ { - "href": "https://actionnetwork.org/api/v2/fundraising_pages/049e9bda-cb79-420d-91ba-92e5a15ba62f/donations/f1119c4e-b8ca-44ff-bfa7-f78f7ca3ec16" + "href": f"{self.api_url}/fundraising_pages/fake_id/donations/fake_id" }, { - "href": "https://actionnetwork.org/api/v2/fundraising_pages/049e9bda-cb79-420d-91ba-92e5a15ba62f/donations/d86538c1-e8f7-46e1-8320-552da81bd48d" + "href": f"{self.api_url}/fundraising_pages/fake_id/donations/fake_id" }, ], "curies": [ @@ -1102,18 +1037,16 @@ def setUp(self, m): "recurring": True, "period": "Monthly", }, - "action_network:person_id": "c945d6fe-929e-11e3-a2e9-12313d316c29", - "action_network:fundraising_page_id": "049e9bda-cb79-420d-91ba-92e5a15ba62f", + "action_network:person_id": "fake_id", + "action_network:fundraising_page_id": "fake_id", "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/fundraising_pages/049e9bda-cb79-420d-91ba-92e5a15ba62f/donations/f1119c4e-b8ca-44ff-bfa7-f78f7ca3ec16" + "href": f"{self.api_url}/fundraising_pages/fake_url" }, "osdi:fundraising_page": { - "href": "https://actionnetwork.org/api/v2/fundraising_pages/049e9bda-cb79-420d-91ba-92e5a15ba62f" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/fake_url" }, + "osdi:person": {"href": f"{self.api_url}/people/fake_url"}, }, }, { @@ -1137,18 +1070,16 @@ def setUp(self, m): "authorization_stored": False, }, "action_network:recurrence": {"recurring": False}, - "action_network:person_id": "c945d6fe-929e-11e3-a2e9-12313d316c29", - "action_network:fundraising_page_id": "049e9bda-cb79-420d-91ba-92e5a15ba62f", + "action_network:person_id": "fake_id", + "action_network:fundraising_page_id": "fake_id", "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/fundraising_pages/049e9bda-cb79-420d-91ba-92e5a15ba62f/donations/d86538c1-e8f7-46e1-8320-552da81bd48d" + "href": "fundraising_pages/fake_id/donations/fake_id" }, "osdi:fundraising_page": { - "href": "https://actionnetwork.org/api/v2/fundraising_pages/049e9bda-cb79-420d-91ba-92e5a15ba62f" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/fundraising_pages/fake_id" }, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, }, }, ] @@ -1171,18 +1102,16 @@ def setUp(self, m): "authorization_stored": False, }, "action_network:recurrence": {"recurring": True, "period": "Monthly"}, - "action_network:person_id": "c945d6fe-929e-11e3-a2e9-12313d316c29", - "action_network:fundraising_page_id": "049e9bda-cb79-420d-91ba-92e5a15ba62f", + "action_network:person_id": "fake_id", + "action_network:fundraising_page_id": "fake_id", "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/fundraising_pages/049e9bda-cb79-420d-91ba-92e5a15ba62f/donations/f1119c4e-b8ca-44ff-bfa7-f78f7ca3ec16" + "href": f"{self.api_url}/fundraising_pages/fake_id/donations/fake_id" }, "osdi:fundraising_page": { - "href": "https://actionnetwork.org/api/v2/fundraising_pages/049e9bda-cb79-420d-91ba-92e5a15ba62f" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/fundraising_pages/fake_id" }, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, "curies": [ { "name": "osdi", @@ -1200,15 +1129,46 @@ def setUp(self, m): # Embeds self.fake_embed = { - "embed_standard_default_styles": "
", - "embed_standard_layout_only_styles": "
", - "embed_standard_no_styles": "
", - "embed_full_default_styles": "
", - "embed_full_layout_only_styles": "
", - "embed_full_no_styles": "
", + "embed_standard_default_styles": "
" + "
", + "embed_standard_layout_only_styles": "" + "
" + "
", + "embed_standard_no_styles": "" + "
" + "
", + "embed_full_default_styles": "" + "
" + "
", + "embed_full_layout_only_styles": "
" + "" + "
", + "embed_full_no_styles": "
" + "
", "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/events/21789f03-0180-45d3-853c-91bd6fdc8c07/embed" + "href": f"{self.api_url}/events/21789f03-0180-45d3-853c-91bd6fdc8c07/embed" }, "curies": [ { @@ -1232,17 +1192,11 @@ def setUp(self, m): "page": 1, "total_records": 237, "_links": { - "next": { - "href": "https://actionnetwork.org/api/v2/event_campaigns?page=2" - }, - "self": {"href": "https://actionnetwork.org/api/v2/event_campaigns"}, + "next": {"href": f"{self.api_url}/event_campaigns?page=2"}, + "self": {"href": f"{self.api_url}/event_campaigns"}, "action_network:event_campaigns": [ - { - "href": "https://actionnetwork.org/api/v2/event_campaigns/874e7e97-973d-4683-b992-61e1ca120710" - }, - { - "href": "https://actionnetwork.org/api/v2/event_campaigns/e948ff6c-9f1e-11e3-a2e9-12313d316c29" - }, + {"href": f"{self.api_url}/event_campaigns/fake_id"}, + {"href": f"{self.api_url}/event_campaigns/fake_id"}, ], "curies": [ { @@ -1260,66 +1214,63 @@ def setUp(self, m): "_embedded": { "action_network:event_campaigns": [ { - "identifiers": [ - "action_network:874e7e97-973d-4683-b992-61e1ca120710" - ], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-03-07T16:50:29Z", "modified_date": "2014-03-07T16:51:16Z", "title": "House parties to help us win!", - "description": "

Host house parties next week to help us win our campaign!

", - "host_pitch": "Hosting a house party is easy! Sign up and we'll give you what you need to know.", - "host_instructions": "

Download our toolkit for all the instructions you need to host an event.

", - "browser_url": "https://actionnetwork.org/event_campaigns/house-parties-to-help-us-win", - "host_url": "https://actionnetwork.org/events/new?event_campaign_id=84", - "featured_image_url": "https://actionnetwork.org/images/events.jpg", + "description": "

Host house parties next " + "week to help us win our campaign!

", + "host_pitch": "Hosting a house party is easy! Sign up and we'll give " + "you what you need to know.", + "host_instructions": "

Download our toolkit for all the " + "instructions you need to host an event.

", + "browser_url": "fake_url", + "host_url": "fake_url", + "featured_image_url": "fake_url", "total_events": 35, "total_rsvps": 467, "action_network:hidden": False, "action_network:sponsor": { "title": "Progressive Action Now", - "url": "https://actionnetwork.org/groups/progressive-action-now", + "url": "fake_url", }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/event_campaigns/874e7e97-973d-4683-b992-61e1ca120710" - }, + "self": {"href": f"{self.api_url}/event_campaigns/fake_id"}, "osdi:events": { - "href": "https://actionnetwork.org/api/v2/event_campaigns/874e7e97-973d-4683-b992-61e1ca120710/events" + "href": f"{self.api_url}/event_campaigns/fake_id/events" }, "action_network:embed": { - "href": "https://actionnetwork.org/api/v2/event_campaigns/874e7e97-973d-4683-b992-61e1ca120710/embed" + "href": f"{self.api_url}/event_campaigns/fake_id/embed" }, }, }, { - "identifiers": [ - "action_network:e948ff6c-9f1e-11e3-a2e9-12313d316c29" - ], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-02-03T16:32:34Z", "modified_date": "2014-02-03T16:42:10Z", "title": "Protest the bad bill in your town", - "description": "

Help us stop this bad bill from becoming law by joining a local protest.

", + "description": "

Help us stop this bad bill from " + "becoming law by joining a local protest.

", "host_pitch": "Hosting is easy, we'll help you out, do it now!", - "host_instructions": "

Here's everything you need to host a protest...

", - "browser_url": "https://actionnetwork.org/event_campaigns/protest-the-bad-bill-in-your-town", - "host_url": "https://actionnetwork.org/events/new?event_campaign_id=82", + "host_instructions": "

Here's everything " + "you need to host a protest...

", + "browser_url": "fake_url", + "host_url": "fake_url", "total_events": 4, "total_rsvps": 11, "action_network:sponsor": { "title": "Progressive Action Now", - "url": "https://actionnetwork.org/groups/progressive-action-now", + "url": "fake_url", }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/event_campaigns/e948ff6c-9f1e-11e3-a2e9-12313d316c29" - }, + "self": {"href": f"{self.api_url}/event_campaigns/fake_id"}, "osdi:events": { - "href": "https://actionnetwork.org/api/v2/event_campaigns/e948ff6c-9f1e-11e3-a2e9-12313d316c29/events" + "href": f"{self.api_url}/event_campaigns/fake_id/events" }, "action_network:embed": { - "href": "https://actionnetwork.org/api/v2/event_campaigns/e948ff6c-9f1e-11e3-a2e9-12313d316c29/embed" + "href": f"{self.api_url}/event_campaigns/fake_id/embed" }, }, }, @@ -1327,33 +1278,32 @@ def setUp(self, m): }, } self.fake_event_campaign = { - "identifiers": ["action_network:e948ff6c-9f1e-11e3-a2e9-12313d316c29"], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-02-03T16:32:34Z", "modified_date": "2014-02-03T16:42:10Z", "title": "Protest the bad bill in your town", - "description": "

Help us stop this bad bill from becoming law by joining a local protest.

", + "description": "

Help us stop this bad bill from becoming" + "law by joining a local protest.

", "host_pitch": "Hosting is easy, we'll help you out, do it now!", "host_instructions": "

Here's everything you need to host a protest...

", - "browser_url": "https://actionnetwork.org/event_campaigns/protest-the-bad-bill-in-your-town", - "host_url": "https://actionnetwork.org/events/new?event_campaign_id=82", - "featured_image_url": "https://actionnetwork.org/images/events.jpg", + "browser_url": "fake_url", + "host_url": "fake_url", + "featured_image_url": "fake_url", "total_events": 4, "total_rsvps": 11, "action_network:hidden": False, "action_network:sponsor": { "title": "Progressive Action Now", - "url": "https://actionnetwork.org/groups/progressive-action-now", + "url": "fake_url", }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/event_campaigns/e948ff6c-9f1e-11e3-a2e9-12313d316c29" - }, + "self": {"href": f"{self.api_url}/event_campaigns/fake_id"}, "osdi:events": { - "href": "https://actionnetwork.org/api/v2/event_campaigns/e948ff6c-9f1e-11e3-a2e9-12313d316c29/events" + "href": f"{self.api_url}/event_campaigns/fake_id/events" }, "action_network:embed": { - "href": "https://actionnetwork.org/api/v2/event_campaigns/e948ff6c-9f1e-11e3-a2e9-12313d316c29/embed" + "href": f"{self.api_url}/event_campaigns/fake_id/embed" }, "curies": [ { @@ -1377,15 +1327,11 @@ def setUp(self, m): "page": 1, "total_records": 250, "_links": { - "next": {"href": "https://actionnetwork.org/api/v2/events?page=2"}, - "self": {"href": "https://actionnetwork.org/api/v2/events"}, + "next": {"href": f"{self.api_url}/events?page=2"}, + "self": {"href": f"{self.api_url}/events"}, "osdi:events": [ - { - "href": "https://actionnetwork.org/api/v2/events/8a625981-67a4-4457-8b55-2e30b267b2c2" - }, - { - "href": "https://actionnetwork.org/api/v2/events/3f976089-4477-461f-9d2f-1d741aa9b7a8" - }, + {"href": f"{self.api_url}/events/fake_id"}, + {"href": f"{self.api_url}/events/fake_id"}, ], "curies": [ { @@ -1405,7 +1351,7 @@ def setUp(self, m): { "origin_system": "FreeEvents.com", "identifiers": [ - "action_network:8a625981-67a4-4457-8b55-2e30b267b2c2", + "action_network:fake_id", "free_events:1", ], "status": "confirmed", @@ -1434,30 +1380,24 @@ def setUp(self, m): }, }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/events/8a625981-67a4-4457-8b55-2e30b267b2c2" - }, + "self": {"href": f"{self.api_url}/events/fake_id"}, "osdi:attendances": { - "href": "https://actionnetwork.org/api/v2/events/8a625981-67a4-4457-8b55-2e30b267b2c2/attendances" + "href": f"{self.api_url}/events/fake_id/attendances" }, "osdi:record_attendance_helper": { - "href": "https://actionnetwork.org/api/v2/events/8a625981-67a4-4457-8b55-2e30b267b2c2/attendances" + "href": f"{self.api_url}/events/fake_id/attendances" }, "osdi:organizer": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" - }, - "osdi:creator": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/people/fake_id" }, + "osdi:creator": {"href": f"{self.api_url}/people/fake_id"}, "action_network:embed": { - "href": "https://actionnetwork.org/api/v2/events/8a625981-67a4-4457-8b55-2e30b267b2c2/embed" + "href": f"{self.api_url}/events/fake_id/embed" }, }, }, { - "identifiers": [ - "action_network:3f976089-4477-461f-9d2f-1d741aa9b7a8" - ], + "identifiers": ["action_network:fake_id"], "status": "confirmed", "created_date": "2014-03-18T21:08:18Z", "modified_date": "2014-03-18T22:15:11Z", @@ -1476,7 +1416,7 @@ def setUp(self, m): "action_network:hidden": False, "action_network:sponsor": { "title": "Progressive Action Now", - "browser_url": "https://actionnetwork.org/groups/progressive-action-now", + "browser_url": "fake_url", }, "location": { "venue": "My house", @@ -1493,23 +1433,19 @@ def setUp(self, m): }, }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/events/3f976089-4477-461f-9d2f-1d741aa9b7a8" - }, + "self": {"href": f"{self.api_url}/events/fake_id"}, "osdi:attendances": { - "href": "https://actionnetwork.org/api/v2/events/3f976089-4477-461f-9d2f-1d741aa9b7a8/attendances" + "href": f"{self.api_url}/events/fake_id/attendances" }, "osdi:record_attendance_helper": { - "href": "https://actionnetwork.org/api/v2/events/3f976089-4477-461f-9d2f-1d741aa9b7a8/attendances" + "href": f"{self.api_url}/events/fake_id/attendances" }, "osdi:organizer": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" - }, - "osdi:creator": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/people/fake_id" }, + "osdi:creator": {"href": f"{self.api_url}/people/fake_id"}, "action_network:embed": { - "href": "https://actionnetwork.org/api/v2/events/3f976089-4477-461f-9d2f-1d741aa9b7a8/embed" + "href": f"{self.api_url}/events/fake_id/embed" }, }, }, @@ -1519,7 +1455,7 @@ def setUp(self, m): self.fake_event2 = { "origin_system": "FreeEvents.com", "identifiers": [ - "action_network:8a625981-67a4-4457-8b55-2e30b267b2c2", + "action_network:fake_id", "free_events:1", ], "status": "confirmed", @@ -1548,23 +1484,17 @@ def setUp(self, m): }, }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/events/8a625981-67a4-4457-8b55-2e30b267b2c2" - }, + "self": {"href": f"{self.api_url}/events/fake_id"}, "osdi:attendances": { - "href": "https://actionnetwork.org/api/v2/events/8a625981-67a4-4457-8b55-2e30b267b2c2/attendances" + "href": f"{self.api_url}/events/fake_id/attendances" }, "osdi:record_attendance_helper": { - "href": "https://actionnetwork.org/api/v2/events/8a625981-67a4-4457-8b55-2e30b267b2c2/attendances" - }, - "osdi:organizer": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" - }, - "osdi:creator": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/events/fake_id/attendances" }, + "osdi:organizer": {"href": f"{self.api_url}/people/fake_id"}, + "osdi:creator": {"href": f"{self.api_url}/people/fake_id"}, "action_network:embed": { - "href": "https://actionnetwork.org/api/v2/events/8a625981-67a4-4457-8b55-2e30b267b2c2/embed" + "href": f"{self.api_url}/events/fake_id/embed" }, "curies": [ { @@ -1588,15 +1518,13 @@ def setUp(self, m): "page": 1, "total_records": 250, "_links": { - "next": {"href": "https://actionnetwork.org/api/v2/forms?page=2"}, - "self": {"href": "https://actionnetwork.org/api/v2/forms"}, + "next": {"href": f"{self.api_url}/forms?page=2"}, + "self": {"href": f"{self.api_url}/forms"}, "osdi:forms": [ { - "href": "https://actionnetwork.org/api/v2/forms/65345d7d-cd24-466a-a698-4a7686ef684f" - }, - { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86" + "href": f"{self.api_url}/forms/65345d7d-cd24-466a-a698-4a7686ef684f" }, + {"href": f"{self.api_url}/forms/fake_id"}, ], "curies": [ { @@ -1628,9 +1556,7 @@ def setUp(self, m): "osdi:creator": { "given_name": "John", "family_name": "Doe", - "identifiers": [ - "action_network:c945d6fe-929e-11e3-a2e9-12313d316c29" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", "email_addresses": [ @@ -1666,52 +1592,44 @@ def setUp(self, m): ], "languages_spoken": ["en"], "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" - }, + "self": {"href": f"{self.api_url}/people/fake_id"}, "osdi:attendances": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/attendances" + "href": f"{self.api_url}/people/fake_id/attendances" }, "osdi:signatures": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/signatures" + "href": f"{self.api_url}/people/fake_id/signatures" }, "osdi:submissions": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/submissions" + "href": f"{self.api_url}/people/fake_id/submissions" }, "osdi:donations": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/donations" + "href": f"{self.api_url}/people/fake_id/donations" }, "osdi:outreaches": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/outreaches" + "href": f"{self.api_url}/people/fake_id/outreaches" }, "osdi:taggings": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/taggings" + "href": f"{self.api_url}/people/fake_id/taggings" }, }, } }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/forms/65345d7d-cd24-466a-a698-4a7686ef684f" - }, + "self": {"href": f"{self.api_url}/forms/fake_id"}, "osdi:submissions": { - "href": "https://actionnetwork.org/api/v2/forms/65345d7d-cd24-466a-a698-4a7686ef684f/submissions" + "href": f"{self.api_url}/forms/fake_id/submissions" }, "osdi:record_submission_helper": { - "href": "https://actionnetwork.org/api/v2/forms/65345d7d-cd24-466a-a698-4a7686ef684f/submissions" - }, - "osdi:creator": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/forms/fake_id/submissions" }, + "osdi:creator": {"href": f"{self.api_url}/people/fake_id"}, "action_network:embed": { - "href": "https://actionnetwork.org/api/v2/forms/65345d7d-cd24-466a-a698-4a7686ef684f/embed" + "href": f"{self.api_url}/forms/fake_id/embed" }, }, }, { - "identifiers": [ - "action_network:adb951cb-51f9-420e-b7e6-de953195ec86" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-21T23:39:53Z", "modified_date": "2014-03-25T15:26:45Z", "title": "Take our end of year survey", @@ -1725,9 +1643,7 @@ def setUp(self, m): "osdi:creator": { "given_name": "John", "family_name": "Doe", - "identifiers": [ - "action_network:c945d6fe-929e-11e3-a2e9-12313d316c29" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", "email_addresses": [ @@ -1763,45 +1679,39 @@ def setUp(self, m): ], "languages_spoken": ["en"], "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" - }, + "self": {"href": f"{self.api_url}/people/fake_id"}, "osdi:attendances": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/attendances" + "href": f"{self.api_url}/people/fake_id/attendances" }, "osdi:signatures": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/signatures" + "href": f"{self.api_url}/people/fake_id/signatures" }, "osdi:submissions": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/submissions" + "href": f"{self.api_url}/people/fake_id/submissions" }, "osdi:donations": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/donations" + "href": f"{self.api_url}/people/fake_id/donations" }, "osdi:outreaches": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/outreaches" + "href": f"{self.api_url}/people/fake_id/outreaches" }, "osdi:taggings": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/taggings" + "href": f"{self.api_url}/people/fake_id/taggings" }, }, } }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86" - }, + "self": {"href": f"{self.api_url}/forms/fake_id"}, "osdi:submissions": { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86/submissions" + "href": f"{self.api_url}/forms/fake_id/submissions" }, "osdi:record_submission_helper": { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86/submissions" - }, - "osdi:creator": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/forms/fake_id/submissions" }, + "osdi:creator": {"href": f"{self.api_url}/people/fake_id"}, "action_network:embed": { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86/embed" + "href": f"{self.api_url}/forms/fake_id/embed" }, }, }, @@ -1809,7 +1719,7 @@ def setUp(self, m): }, } self.fake_form = { - "identifiers": ["action_network:adb951cb-51f9-420e-b7e6-de953195ec86"], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-21T23:39:53Z", "modified_date": "2014-03-25T15:26:45Z", "title": "Take our end of year survey", @@ -1823,9 +1733,7 @@ def setUp(self, m): "osdi:creator": { "given_name": "John", "family_name": "Doe", - "identifiers": [ - "action_network:c945d6fe-929e-11e3-a2e9-12313d316c29" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", "email_addresses": [ @@ -1861,26 +1769,24 @@ def setUp(self, m): ], "languages_spoken": ["en"], "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" - }, + "self": {"href": f"{self.api_url}/people/fake_id"}, "osdi:attendances": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/attendances" + "href": f"{self.api_url}/people/fake_id/attendances" }, "osdi:signatures": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/signatures" + "href": f"{self.api_url}/people/fake_id/signatures" }, "osdi:submissions": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/submissions" + "href": f"{self.api_url}/people/fake_id/submissions" }, "osdi:donations": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/donations" + "href": f"{self.api_url}/people/fake_id/donations" }, "osdi:outreaches": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/outreaches" + "href": f"{self.api_url}/people/fake_id/outreaches" }, "osdi:taggings": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/taggings" + "href": f"{self.api_url}/people/fake_id/taggings" }, "curies": [ { @@ -1898,21 +1804,15 @@ def setUp(self, m): } }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86" - }, + "self": {"href": f"{self.api_url}/forms/fake_id"}, "osdi:submissions": { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86/submissions" + "href": f"{self.api_url}/forms/fake_id/submissions" }, "osdi:record_submission_helper": { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86/submissions" - }, - "osdi:creator": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" - }, - "action_network:embed": { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86/embed" + "href": f"{self.api_url}/forms/fake_id/submissions" }, + "osdi:creator": {"href": f"{self.api_url}/people/fake_id"}, + "action_network:embed": {"href": f"{self.api_url}/forms/fake_id/embed"}, "curies": [ { "name": "osdi", @@ -1970,7 +1870,7 @@ def setUp(self, m): }, } self.fake_fundraising_page = { - "identifiers": ["action_network:049e9bda-cb79-420d-91ba-92e5a15ba62f"], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-04T18:14:03Z", "modified_date": "2014-03-24T16:07:13Z", "title": "Year end fundraising", @@ -1985,9 +1885,7 @@ def setUp(self, m): "osdi:creator": { "given_name": "John", "family_name": "Doe", - "identifiers": [ - "action_network:c945d6fe-929e-11e3-a2e9-12313d316c29" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-24T19:39:40Z", "modified_date": "2014-03-24T19:48:23Z", "email_addresses": [ @@ -2023,26 +1921,24 @@ def setUp(self, m): ], "languages_spoken": ["en"], "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" - }, + "self": {"href": f"{self.api_url}/people/fake_id"}, "osdi:attendances": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/attendances" + "href": f"{self.api_url}/people/fake_id/attendances" }, "osdi:signatures": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/signatures" + "href": f"{self.api_url}/people/fake_id/signatures" }, "osdi:submissions": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/submissions" + "href": f"{self.api_url}/people/fake_id/submissions" }, "osdi:donations": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/donations" + "href": f"{self.api_url}/people/fake_id/donations" }, "osdi:outreaches": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/outreaches" + "href": f"{self.api_url}/people/fake_id/outreaches" }, "osdi:taggings": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/taggings" + "href": f"{self.api_url}/people/fake_id/taggings" }, "curies": [ { @@ -2064,20 +1960,16 @@ def setUp(self, m): "url": "https://actionnetwork.org/groups/progressive-action-now", }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/fundraising_pages/049e9bda-cb79-420d-91ba-92e5a15ba62f" - }, + "self": {"href": f"{self.api_url}/fundraising_pages/fake_id"}, "osdi:donations": { - "href": "https://actionnetwork.org/api/v2/fundraising_pages/049e9bda-cb79-420d-91ba-92e5a15ba62f/donations" + "href": f"{self.api_url}/fundraising_pages/fake_id/donations" }, "osdi:record_donation_helper": { - "href": "https://actionnetwork.org/api/v2/fundraising_pages/049e9bda-cb79-420d-91ba-92e5a15ba62f/donations" - }, - "osdi:creator": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/fundraising_pages/fake_id/donations" }, + "osdi:creator": {"href": f"{self.api_url}/people/fake_id"}, "action_network:embed": { - "href": "https://actionnetwork.org/api/v2/fundraising_pages/049e9bda-cb79-420d-91ba-92e5a15ba62f/embed" + "href": f"{self.api_url}/fundraising_pages/fake_id/embed" }, "curies": [ { @@ -2099,19 +1991,11 @@ def setUp(self, m): "per_page": 25, "page": 1, "_links": { - "next": { - "href": "https://actionnetwork.org/api/v2/lists/71f8feef-61c8-4e6b-9745-ec1d7752f298/items?page=2" - }, - "self": { - "href": "https://actionnetwork.org/api/v2/lists/71f8feef-61c8-4e6b-9745-ec1d7752f298/items" - }, + "next": {"href": f"{self.api_url}/lists/fake_id/items?page=2"}, + "self": {"href": f"{self.api_url}/lists/fake_id/items"}, "osdi:items": [ - { - "href": "https://actionnetwork.org/api/v2/lists/71f8feef-61c8-4e6b-9745-ec1d7752f298/items/82e909f9-1ac7-4952-bbd4-b4690a14bec2" - }, - { - "href": "https://actionnetwork.org/api/v2/lists/71f8feef-61c8-4e6b-9745-ec1d7752f298/items/a9ccd87c-97f4-48db-9e6b-507509091839" - }, + {"href": f"{self.api_url}/lists/fake_id/items/fake_id"}, + {"href": f"{self.api_url}/lists/fake_id/items/fake_id"}, ], "curies": [ { @@ -2131,59 +2015,41 @@ def setUp(self, m): { "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/lists/71f8feef-61c8-4e6b-9745-ec1d7752f298/items/82e909f9-1ac7-4952-bbd4-b4690a14bec2" - }, - "osdi:list": { - "href": "https://actionnetwork.org/api/v2/lists/71f8feef-61c8-4e6b-9745-ec1d7752f298" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/82e909f9-1ac7-4952-bbd4-b4690a14bec2" + "href": f"{self.api_url}/lists/fake_id/items/fake_id" }, + "osdi:list": {"href": f"{self.api_url}/lists/fake_id"}, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, }, - "identifiers": [ - "action_network:82e909f9-1ac7-4952-bbd4-b4690a14bec2" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-18T22:25:31Z", "modified_date": "2014-03-18T22:25:38Z", "item_type": "osdi:person", - "action_network:person_id": "82e909f9-1ac7-4952-bbd4-b4690a14bec2", - "action_network:list_id": "71f8feef-61c8-4e6b-9745-ec1d7752f298", + "action_network:person_id": "fake_id", + "action_network:list_id": "fake_id", }, { "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/lists/71f8feef-61c8-4e6b-9745-ec1d7752f298/items/a9ccd87c-97f4-48db-9e6b-507509091839" - }, - "osdi:list": { - "href": "https://actionnetwork.org/api/v2/lists/71f8feef-61c8-4e6b-9745-ec1d7752f298" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/a9ccd87c-97f4-48db-9e6b-507509091839" + "href": f"{self.api_url}/lists/fake_id/items/fake_id" }, + "osdi:list": {"href": f"{self.api_url}/lists/fake_id"}, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, }, - "identifiers": [ - "action_network:a9ccd87c-97f4-48db-9e6b-507509091839" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-18T22:24:24Z", "modified_date": "2014-03-18T22:24:24Z", "item_type": "osdi:person", - "action_network:person_id": "a9ccd87c-97f4-48db-9e6b-507509091839", - "action_network:list_id": "71f8feef-61c8-4e6b-9745-ec1d7752f298", + "action_network:person_id": "fake_id", + "action_network:list_id": "fake_id", }, ] }, } self.fake_item = { "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/lists/71f8feef-61c8-4e6b-9745-ec1d7752f298/items/82e909f9-1ac7-4952-bbd4-b4690a14bec2" - }, - "osdi:list": { - "href": "https://actionnetwork.org/api/v2/lists/71f8feef-61c8-4e6b-9745-ec1d7752f298" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/82e909f9-1ac7-4952-bbd4-b4690a14bec2" - }, + "self": {"href": f"{self.api_url}/lists/fake_id/items/fake_id"}, + "osdi:list": {"href": f"{self.api_url}/lists/fake_id"}, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, "curies": [ { "name": "osdi", @@ -2197,12 +2063,12 @@ def setUp(self, m): }, ], }, - "identifiers": ["action_network:82e909f9-1ac7-4952-bbd4-b4690a14bec2"], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-18T22:25:31Z", "modified_date": "2014-03-18T22:25:38Z", "item_type": "osdi:person", - "action_network:person_id": "82e909f9-1ac7-4952-bbd4-b4690a14bec2", - "action_network:list_id": "71f8feef-61c8-4e6b-9745-ec1d7752f298", + "action_network:person_id": "fake_id", + "action_network:list_id": "fake_id", } # Lists @@ -2212,15 +2078,11 @@ def setUp(self, m): "page": 1, "total_records": 243, "_links": { - "next": {"href": "https://actionnetwork.org/api/v2/lists?page=2"}, - "self": {"href": "https://actionnetwork.org/api/v2/lists"}, + "next": {"href": f"{self.api_url}/lists?page=2"}, + "self": {"href": f"{self.api_url}/lists"}, "osdi:lists": [ - { - "href": "https://actionnetwork.org/api/v2/lists/71f8feef-61c8-4e6b-9745-ec1d7752f298" - }, - { - "href": "https://actionnetwork.org/api/v2/lists/fc0a1ec6-5743-4b98-ae0c-cea8766b2212" - }, + {"href": f"{self.api_url}/lists/fake_id"}, + {"href": f"{self.api_url}/lists/fake_id"}, ], "curies": [ { @@ -2238,40 +2100,32 @@ def setUp(self, m): "_embedded": { "osdi:lists": [ { - "identifiers": [ - "action_network:71f8feef-61c8-4e6b-9745-ec1d7752f298" - ], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-03-25T17:11:33Z", "modified_date": "2014-03-25T17:13:33Z", "title": "Stop Doing The Bad Thing Petition Signers", "description": "Report", - "browser_url": "https://actionnetwork.org/reports/stop-doing-the-bad-thing-petition-signers/manage", + "browser_url": "fake_url", "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/lists/71f8feef-61c8-4e6b-9745-ec1d7752f298" - }, + "self": {"href": f"{self.api_url}/lists/fake_id"}, "osdi:items": { - "href": "https://actionnetwork.org/api/v2/lists/71f8feef-61c8-4e6b-9745-ec1d7752f298/items" + "href": f"{self.api_url}/lists/fake_id/items" }, }, }, { - "identifiers": [ - "action_network:fc0a1ec6-5743-4b98-ae0c-cea8766b2212" - ], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-03-24T18:26:42Z", "modified_date": "2014-03-24T18:27:17Z", "title": "Sign our new petition!", "description": "Email", - "browser_url": "https://actionnetwork.org/emails/sign-our-new-petition/manage", + "browser_url": "fake_url", "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/lists/fc0a1ec6-5743-4b98-ae0c-cea8766b2212" - }, + "self": {"href": f"{self.api_url}/lists/fake_id"}, "osdi:items": { - "href": "https://actionnetwork.org/api/v2/lists/fc0a1ec6-5743-4b98-ae0c-cea8766b2212/items" + "href": f"{self.api_url}/lists/fake_id/items" }, }, }, @@ -2279,20 +2133,16 @@ def setUp(self, m): }, } self.fake_list = { - "identifiers": ["action_network:71f8feef-61c8-4e6b-9745-ec1d7752f298"], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-03-25T17:11:33Z", "modified_date": "2014-03-25T17:13:33Z", "title": "Stop Doing The Bad Thing Petition Signers", "description": "Report", - "browser_url": "https://actionnetwork.org/reports/stop-doing-the-bad-thing-petition-signers/manage", + "browser_url": "fake_url", "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/lists/71f8feef-61c8-4e6b-9745-ec1d7752f298" - }, - "osdi:items": { - "href": "https://actionnetwork.org/api/v2/lists/71f8feef-61c8-4e6b-9745-ec1d7752f298/items" - }, + "self": {"href": f"{self.api_url}/lists/fake_id"}, + "osdi:items": {"href": f"{self.api_url}/lists/fake_id/items"}, "curies": [ { "name": "osdi", @@ -2315,15 +2165,11 @@ def setUp(self, m): "page": 1, "total_records": 162, "_links": { - "next": {"href": "https://actionnetwork.org/api/v2/messages?page=2"}, - "self": {"href": "https://actionnetwork.org/api/v2/messages"}, + "next": {"href": f"{self.api_url}/messages?page=2"}, + "self": {"href": f"{self.api_url}/messages"}, "osdi:messages": [ - { - "href": "https://actionnetwork.org/api/v2/messages/a4dde5b6-0512-48ea-b4ad-63a71117b43d" - }, - { - "href": "https://actionnetwork.org/api/v2/messages/a27178b9-45c3-4844-8ebf-ebd5da74a1e3" - }, + {"href": f"{self.api_url}/messages/fake_id"}, + {"href": f"{self.api_url}/messages/fake_id"}, ], "curies": [ { @@ -2341,9 +2187,7 @@ def setUp(self, m): "_embedded": { "osdi:messages": [ { - "identifiers": [ - "action_network:a4dde5b6-0512-48ea-b4ad-63a71117b43d" - ], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", @@ -2351,16 +2195,12 @@ def setUp(self, m): "body": "

The mayor should stop doing the bad thing.

", "from": "Progressive Action Now", "reply_to": "jane@progressiveactionnow.org", - "administrative_url": "https://actionnetwork.org/emails/stop-doing-the-bad-thing/manage", + "administrative_url": "fake_url", "total_targeted": 2354, "status": "sent", "sent_start_date": "2014-03-26T15:00:22Z", "type": "email", - "targets": [ - { - "href": "https://actionnetwork.org/api/v2/queries/2cba37d8-1fbf-11e7-8cc2-22000aedd9ed" - } - ], + "targets": [{"href": f"{self.api_url}/queries/fake_id"}], "statistics": { "sent": 2354, "opened": 563, @@ -2373,49 +2213,46 @@ def setUp(self, m): "spam_reports": 1, }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/messages/a4dde5b6-0512-48ea-b4ad-63a71117b43d" - }, + "self": {"href": f"{self.api_url}/messages/fake_id"}, "osdi:wrapper": { - "href": "https://actionnetwork.org/api/v2/wrappers/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/wrappers/fake_id" }, "osdi:recipients": { - "href": "https://actionnetwork.org/api/v2/lists/950e9954-606f-43e6-be99-2bc0bc2072a1" + "href": f"{self.api_url}/lists/950e9954-606f-43e6-be99-2bc0bc2072a1" }, "osdi:send_helper": { - "href": "https://actionnetwork.org/api/v2/messages/a4dde5b6-0512-48ea-b4ad-63a71117b43d/send" + "href": f"{self.api_url}/messages/fake_id/send" }, "osdi:schedule_helper": { - "href": "https://actionnetwork.org/api/v2/messages/a4dde5b6-0512-48ea-b4ad-63a71117b43d/schedule" + "href": f"{self.api_url}/messages/fake_id/schedule" }, }, }, { "identifiers": [ - "action_network:a27178b9-45c3-4844-8ebf-ebd5da74a1e3", + "action_network:fake_id", "foreign_system:1", ], "origin_system": "My Email Making System", "created_date": "2014-03-27T18:03:45Z", "modified_date": "2014-03-28T15:00:22Z", "subject": "FWD: Stop doing the bad thing", - "body": "

Have you signed yet? The mayor should stop doing the bad thing.

", + "body": "

Have you signed yet? " + "The mayor should stop doing the bad thing.

", "from": "Progressive Action Now", "reply_to": "jane@progressiveactionnow.org", - "administrative_url": "https://actionnetwork.org/emails/fwd-stop-doing-the-bad-thing/manage", + "administrative_url": "fake_url", "total_targeted": 12673, "status": "draft", "type": "email", "targets": [], "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/messages/a27178b9-45c3-4844-8ebf-ebd5da74a1e3" - }, + "self": {"href": f"{self.api_url}/messages/fake_id"}, "osdi:send_helper": { - "href": "https://actionnetwork.org/api/v2/messages/a27178b9-45c3-4844-8ebf-ebd5da74a1e3/send" + "href": f"{self.api_url}/messages/fake_id/send" }, "osdi:schedule_helper": { - "href": "https://actionnetwork.org/api/v2/messages/a27178b9-45c3-4844-8ebf-ebd5da74a1e3/schedule" + "href": f"{self.api_url}/messages/fake_id/schedule" }, }, }, @@ -2423,7 +2260,7 @@ def setUp(self, m): }, } self.fake_message = { - "identifiers": ["action_network:a4dde5b6-0512-48ea-b4ad-63a71117b43d"], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", @@ -2431,16 +2268,12 @@ def setUp(self, m): "body": "

The mayor should stop doing the bad thing.

", "from": "Progressive Action Now", "reply_to": "jane@progressiveactionnow.org", - "administrative_url": "https://actionnetwork.org/emails/stop-doing-the-bad-thing/manage", + "administrative_url": "fake_url", "total_targeted": 2354, "status": "sent", "sent_start_date": "2014-03-26T15:00:22Z", "type": "email", - "targets": [ - { - "href": "https://actionnetwork.org/api/v2/queries/2cba37d8-1fbf-11e7-8cc2-22000aedd9ed" - } - ], + "targets": [{"href": f"{self.api_url}/queries/fake_id"}], "statistics": { "sent": 2354, "opened": 563, @@ -2453,20 +2286,14 @@ def setUp(self, m): "spam_reports": 1, }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/messages/a4dde5b6-0512-48ea-b4ad-63a71117b43d" - }, - "osdi:wrapper": { - "href": "https://actionnetwork.org/api/v2/wrappers/c945d6fe-929e-11e3-a2e9-12313d316c29" - }, + "self": {"href": f"{self.api_url}/messages/fake_id"}, + "osdi:wrapper": {"href": f"{self.api_url}/wrappers/fake_id"}, "osdi:recipients": { - "href": "https://actionnetwork.org/api/v2/lists/950e9954-606f-43e6-be99-2bc0bc2072a1" - }, - "osdi:send_helper": { - "href": "https://actionnetwork.org/api/v2/messages/a4dde5b6-0512-48ea-b4ad-63a71117b43d/send" + "href": f"{self.api_url}/lists/950e9954-606f-43e6-be99-2bc0bc2072a1" }, + "osdi:send_helper": {"href": f"{self.api_url}/messages/fake_id/send"}, "osdi:schedule_helper": { - "href": "https://actionnetwork.org/api/v2/messages/a4dde5b6-0512-48ea-b4ad-63a71117b43d/schedule" + "href": f"{self.api_url}/messages/fake_id/schedule" }, }, } @@ -2502,14 +2329,14 @@ def setUp(self, m): "total_records": 6, "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/049e9bda-cb79-420d-91ba-92e5a15ba62f/outreaches" + "href": f"{self.api_url}/advocacy_campaigns/fake_id/outreaches" }, "osdi:outreaches": [ { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/049e9bda-cb79-420d-91ba-92e5a15ba62f/outreaches/f1119c4e-b8ca-44ff-bfa7-f78f7ca3ec16" + "href": f"{self.api_url}/advocacy_campaigns/fake_id/outreaches/fake_id" }, { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/049e9bda-cb79-420d-91ba-92e5a15ba62f/outreaches/d86538c1-e8f7-46e1-8320-552da81bd48d" + "href": f"{self.api_url}/advocacy_campaigns/fake_id/outreaches/dfake_id" }, ], "curies": [ @@ -2544,18 +2371,16 @@ def setUp(self, m): "ocdid": "ocd-division/country:us/state:ny/cd:18", } ], - "action_network:person_id": "c945d6fe-929e-11e3-a2e9-12313d316c29", - "action_network:advocacy_campaign_id": "049e9bda-cb79-420d-91ba-92e5a15ba62f", + "action_network:person_id": "fake_id", + "action_network:advocacy_campaign_id": "fake_id", "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/049e9bda-cb79-420d-91ba-92e5a15ba62f/outreaches/f1119c4e-b8ca-44ff-bfa7-f78f7ca3ec16" + "href": "/advocacy_campaigns/fake_id/outreaches/fake_id" }, "osdi:advocacy_campaign": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/049e9bda-cb79-420d-91ba-92e5a15ba62f" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/advocacy_campaigns/fake_id" }, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, }, }, { @@ -2575,18 +2400,16 @@ def setUp(self, m): "ocdid": "ocd-division/country:us/state:ca/sldl:110", } ], - "action_network:person_id": "c945d6fe-929e-11e3-a2e9-12313d316c29", - "action_network:advocacy_campaign_id": "049e9bda-cb79-420d-91ba-92e5a15ba62f", + "action_network:person_id": "fake_id", + "action_network:advocacy_campaign_id": "fake_id", "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/049e9bda-cb79-420d-91ba-92e5a15ba62f/outreaches/d86538c1-e8f7-46e1-8320-552da81bd48d" + "href": "advocacy_campaigns/fake_id/outreaches/fake_id" }, "osdi:advocacy_campaign": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/049e9bda-cb79-420d-91ba-92e5a15ba62f" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/advocacy_campaigns/fake_id" }, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, }, }, ] @@ -2607,18 +2430,16 @@ def setUp(self, m): "ocdid": "ocd-division/country:us/state:ny/cd:18", } ], - "action_network:person_id": "c945d6fe-929e-11e3-a2e9-12313d316c29", - "action_network:advocacy_campaign_id": "049e9bda-cb79-420d-91ba-92e5a15ba62f", + "action_network:person_id": "fake_id", + "action_network:advocacy_campaign_id": "fake_id", "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/fundraising_page/049e9bda-cb79-420d-91ba-92e5a15ba62f/outreaches/f1119c4e-b8ca-44ff-bfa7-f78f7ca3ec16" + "href": f"{self.api_url}/fundraising_page/fake_id/outreaches/fake_id" }, "osdi:advocacy_campaign": { - "href": "https://actionnetwork.org/api/v2/advocacy_campaigns/049e9bda-cb79-420d-91ba-92e5a15ba62f" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/advocacy_campaigns/fake_id" }, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, "curies": [ { "name": "osdi", @@ -2639,14 +2460,10 @@ def setUp(self, m): "per_page": 25, "page": 1, "_links": { - "next": {"href": "https://actionnetwork.org/api/v2/people?page=2"}, + "next": {"href": f"{self.api_url}/people?page=2"}, "osdi:people": [ - { - "href": "https://actionnetwork.org/api/v2/people/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3" - }, - { - "href": "https://actionnetwork.org/api/v2/people/1efc3644-af25-4253-90b8-a0baf12dbd1e" - }, + {"href": f"{self.api_url}/people/fake_id"}, + {"href": f"{self.api_url}/people/fake_id"}, ], "curies": [ { @@ -2660,7 +2477,7 @@ def setUp(self, m): "templated": True, }, ], - "self": {"href": "https://actionnetwork.org/api/v2/people"}, + "self": {"href": f"{self.api_url}/people"}, }, "_embedded": { "osdi:people": [ @@ -2668,7 +2485,7 @@ def setUp(self, m): "given_name": "John", "family_name": "Smith", "identifiers": [ - "action_network:d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3", + "action_network:fake_id", "foreign_system:1", ], "created_date": "2014-03-20T21:04:31Z", @@ -2710,35 +2527,31 @@ def setUp(self, m): "I am a parent": "1", }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/people/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3" - }, + "self": {"href": f"{self.api_url}/people/fake_id"}, "osdi:attendances": { - "href": "https://actionnetwork.org/api/v2/people/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3/attendances" + "href": f"{self.api_url}/people/fake_id/attendances" }, "osdi:signatures": { - "href": "https://actionnetwork.org/api/v2/people/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3/signatures" + "href": f"{self.api_url}/people/fake_id/signatures" }, "osdi:submissions": { - "href": "https://actionnetwork.org/api/v2/people/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3/submissions" + "href": f"{self.api_url}/people/fake_id/submissions" }, "osdi:donations": { - "href": "https://actionnetwork.org/api/v2/people/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3/donations" + "href": f"{self.api_url}/people/fake_id/donations" }, "osdi:outreaches": { - "href": "https://actionnetwork.org/api/v2/people/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3/outreaches" + "href": f"{self.api_url}/people/fake_id/outreaches" }, "osdi:taggings": { - "href": "https://actionnetwork.org/api/v2/people/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3/taggings" + "href": f"{self.api_url}/people/fake_id/taggings" }, }, }, { "given_name": "Jane", "family_name": "Doe", - "identifiers": [ - "action_network:1efc3644-af25-4253-90b8-a0baf12dbd1e" - ], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-03-20T20:44:13Z", "modified_date": "2014-03-20T20:44:13Z", @@ -2773,26 +2586,24 @@ def setUp(self, m): ], "languages_spoken": ["en"], "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/people/1efc3644-af25-4253-90b8-a0baf12dbd1e" - }, + "self": {"href": f"{self.api_url}/people/fake_id"}, "osdi:attendances": { - "href": "https://actionnetwork.org/api/v2/people/1efc3644-af25-4253-90b8-a0baf12dbd1e/attendances" + "href": f"{self.api_url}/people/fake_id/attendances" }, "osdi:signatures": { - "href": "https://actionnetwork.org/api/v2/people/1efc3644-af25-4253-90b8-a0baf12dbd1e/signatures" + "href": f"{self.api_url}/people/fake_id/signatures" }, "osdi:submissions": { - "href": "https://actionnetwork.org/api/v2/people/1efc3644-af25-4253-90b8-a0baf12dbd1e/submissions" + "href": f"{self.api_url}/people/fake_id/submissions" }, "osdi:donations": { - "href": "https://actionnetwork.org/api/v2/people/1efc3644-af25-4253-90b8-a0baf12dbd1e/donations" + "href": f"{self.api_url}/people/fake_id/donations" }, "osdi:outreaches": { - "href": "https://actionnetwork.org/api/v2/people/1efc3644-af25-4253-90b8-a0baf12dbd1e/outreaches" + "href": f"{self.api_url}/people/fake_id/outreaches" }, "osdi:taggings": { - "href": "https://actionnetwork.org/api/v2/people/1efc3644-af25-4253-90b8-a0baf12dbd1e/taggings" + "href": f"{self.api_url}/people/fake_id/taggings" }, }, }, @@ -2807,15 +2618,11 @@ def setUp(self, m): "page": 1, "total_records": 162, "_links": { - "next": {"href": "https://actionnetwork.org/api/v2/petitions?page=2"}, - "self": {"href": "https://actionnetwork.org/api/v2/petitions"}, + "next": {"href": f"{self.api_url}/petitions?page=2"}, + "self": {"href": f"{self.api_url}/petitions"}, "osdi:petitions": [ - { - "href": "https://actionnetwork.org/api/v2/petitions/a4dde5b6-0512-48ea-b4ad-63a71117b43d" - }, - { - "href": "https://actionnetwork.org/api/v2/petitions/a27178b9-45c3-4844-8ebf-ebd5da74a1e3" - }, + {"href": f"{self.api_url}/petitions/fake_id"}, + {"href": f"{self.api_url}/petitions/fake_id"}, ], "curies": [ { @@ -2833,17 +2640,15 @@ def setUp(self, m): "_embedded": { "osdi:petitions": [ { - "identifiers": [ - "action_network:a4dde5b6-0512-48ea-b4ad-63a71117b43d" - ], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", "title": "Stop doing the bad thing", "description": "

The mayor should stop doing the bad.

", "petition_text": "Mayor, stop doing the bad thing", - "browser_url": "https://actionnetwork.org/petitions/stop-doing-the-bad-thing", - "featured_image_url": "https://actionnetwork.org/images/stop-doing-the-bad-thing.jpg", + "browser_url": "fake_url", + "featured_image_url": "fake_url", "total_signatures": 2354, "target": [{"name": "The Mayor"}], "action_network:hidden": False, @@ -2851,9 +2656,7 @@ def setUp(self, m): "osdi:creator": { "given_name": "John", "family_name": "Doe", - "identifiers": [ - "action_network:c945d6fe-929e-11e3-a2e9-12313d316c29" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", "email_addresses": [ @@ -2889,51 +2692,45 @@ def setUp(self, m): ], "languages_spoken": ["en"], "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" - }, + "self": {"href": f"{self.api_url}/people/fake_id"}, "osdi:attendances": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/attendances" + "href": f"{self.api_url}/people/fake_id/attendances" }, "osdi:signatures": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/signatures" + "href": f"{self.api_url}/people/fake_id/signatures" }, "osdi:submissions": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/submissions" + "href": f"{self.api_url}/people/fake_id/submissions" }, "osdi:donations": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/donations" + "href": f"{self.api_url}/people/fake_id/donations" }, "osdi:outreaches": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/outreaches" + "href": f"{self.api_url}/people/fake_id/outreaches" }, "osdi:taggings": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/taggings" + "href": f"{self.api_url}/people/fake_id/taggings" }, }, } }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/petitions/a4dde5b6-0512-48ea-b4ad-63a71117b43d" - }, + "self": {"href": f"{self.api_url}/petitions/fake_id"}, "osdi:signatures": { - "href": "https://actionnetwork.org/api/v2/petitions/a4dde5b6-0512-48ea-b4ad-63a71117b43d/signatures" + "href": f"{self.api_url}/petitions/fake_id/signatures" }, "osdi:record_signature_helper": { - "href": "https://actionnetwork.org/api/v2/petitions/a4dde5b6-0512-48ea-b4ad-63a71117b43d/signatures" - }, - "osdi:creator": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/petitions/fake_id/signatures" }, + "osdi:creator": {"href": f"{self.api_url}/people/fake_id"}, "action_network:embed": { - "href": "https://actionnetwork.org/api/v2/petitions/a4dde5b6-0512-48ea-b4ad-63a71117b43d/embed" + "href": f"{self.api_url}/petitions/fake_id/embed" }, }, }, { "identifiers": [ - "action_network:a27178b9-45c3-4844-8ebf-ebd5da74a1e3", + "action_network:fake_id", "foreign_system:1", ], "origin_system": "Another System", @@ -2946,9 +2743,7 @@ def setUp(self, m): "osdi:creator": { "given_name": "John", "family_name": "Doe", - "identifiers": [ - "action_network:c945d6fe-929e-11e3-a2e9-12313d316c29" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", "email_addresses": [ @@ -2984,26 +2779,24 @@ def setUp(self, m): ], "languages_spoken": ["en"], "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" - }, + "self": {"href": f"{self.api_url}/people/fake_id"}, "osdi:attendances": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/attendances" + "href": f"{self.api_url}/people/fake_id/attendances" }, "osdi:signatures": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/signatures" + "href": f"{self.api_url}/people/fake_id/signatures" }, "osdi:submissions": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/submissions" + "href": f"{self.api_url}/people/fake_id/submissions" }, "osdi:donations": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/donations" + "href": f"{self.api_url}/people/fake_id/donations" }, "osdi:outreaches": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/outreaches" + "href": f"{self.api_url}/people/fake_id/outreaches" }, "osdi:taggings": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/taggings" + "href": f"{self.api_url}/people/fake_id/taggings" }, }, } @@ -3013,20 +2806,16 @@ def setUp(self, m): "url": "https://actionnetwork.org/groups/progressive-action-now", }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/petitions/a27178b9-45c3-4844-8ebf-ebd5da74a1e3" - }, + "self": {"href": f"{self.api_url}/petitions/fake_id"}, "osdi:signatures": { - "href": "https://actionnetwork.org/api/v2/petitions/a27178b9-45c3-4844-8ebf-ebd5da74a1e3/signatures" + "href": f"{self.api_url}/petitions/fake_id/signatures" }, "osdi:record_signature_helper": { - "href": "https://actionnetwork.org/api/v2/petitions/a27178b9-45c3-4844-8ebf-ebd5da74a1e3/signatures" - }, - "osdi:creator": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/petitions/fake_id/signatures" }, + "osdi:creator": {"href": f"{self.api_url}/people/fake_id"}, "action_network:embed": { - "href": "https://actionnetwork.org/api/v2/petitions/a27178b9-45c3-4844-8ebf-ebd5da74a1e3/embed" + "href": f"{self.api_url}/petitions/fake_id/embed" }, }, }, @@ -3034,7 +2823,7 @@ def setUp(self, m): }, } self.fake_petition = { - "identifiers": ["action_network:a4dde5b6-0512-48ea-b4ad-63a71117b43d"], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", @@ -3050,9 +2839,7 @@ def setUp(self, m): "osdi:creator": { "given_name": "John", "family_name": "Doe", - "identifiers": [ - "action_network:c945d6fe-929e-11e3-a2e9-12313d316c29" - ], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", @@ -3089,26 +2876,24 @@ def setUp(self, m): ], "languages_spoken": ["en"], "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" - }, + "self": {"href": f"{self.api_url}/people/fake_id"}, "osdi:attendances": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/attendances" + "href": f"{self.api_url}/people/fake_id/attendances" }, "osdi:signatures": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/signatures" + "href": f"{self.api_url}/people/fake_id/signatures" }, "osdi:submissions": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/submissions" + "href": f"{self.api_url}/people/fake_id/submissions" }, "osdi:donations": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/donations" + "href": f"{self.api_url}/people/fake_id/donations" }, "osdi:outreaches": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/outreaches" + "href": f"{self.api_url}/people/fake_id/outreaches" }, "osdi:taggings": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29/taggings" + "href": f"{self.api_url}/people/fake_id/taggings" }, "curies": [ { @@ -3126,20 +2911,16 @@ def setUp(self, m): } }, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/petitions/a4dde5b6-0512-48ea-b4ad-63a71117b43d" - }, + "self": {"href": f"{self.api_url}/petitions/fake_id"}, "osdi:signatures": { - "href": "https://actionnetwork.org/api/v2/petitions/a4dde5b6-0512-48ea-b4ad-63a71117b43d/signatures" + "href": f"{self.api_url}/petitions/fake_id/signatures" }, "osdi:record_signature_helper": { - "href": "https://actionnetwork.org/api/v2/petitions/a4dde5b6-0512-48ea-b4ad-63a71117b43d/signatures" - }, - "osdi:creator": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/petitions/fake_id/signatures" }, + "osdi:creator": {"href": f"{self.api_url}/people/fake_id"}, "action_network:embed": { - "href": "https://actionnetwork.org/api/v2/petitions/a4dde5b6-0512-48ea-b4ad-63a71117b43d/embed" + "href": f"{self.api_url}/petitions/fake_id/embed" }, "curies": [ { @@ -3163,15 +2944,11 @@ def setUp(self, m): "page": 1, "total_records": 162, "_links": { - "next": {"href": "https://actionnetwork.org/api/v2/queries?page=2"}, - "self": {"href": "https://actionnetwork.org/api/v2/queries"}, + "next": {"href": f"{self.api_url}/queries?page=2"}, + "self": {"href": f"{self.api_url}/queries"}, "osdi:queries": [ - { - "href": "https://actionnetwork.org/api/v2/queries/a4dde5b6-0512-48ea-b4ad-63a71117b43d" - }, - { - "href": "https://actionnetwork.org/api/v2/queries/a27178b9-45c3-4844-8ebf-ebd5da74a1e3" - }, + {"href": f"{self.api_url}/queries/fake_id"}, + {"href": f"{self.api_url}/queries/fake_id"}, ], "curies": [ { @@ -3189,49 +2966,35 @@ def setUp(self, m): "_embedded": { "osdi:queries": [ { - "identifiers": [ - "action_network:a4dde5b6-0512-48ea-b4ad-63a71117b43d" - ], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", "name": "All donors", "browser_url": "https://actionnetwork.org/queries/1/edit", - "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/queries/a4dde5b6-0512-48ea-b4ad-63a71117b43d" - } - }, + "_links": {"self": {"href": f"{self.api_url}/queries/fake_id"}}, }, { - "identifiers": [ - "action_network:a27178b9-45c3-4844-8ebf-ebd5da74a1e3" - ], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-03-14T15:21:05Z", "modified_date": "2014-03-17T19:56:11Z", "name": "Volunteer prospects", "browser_url": "https://actionnetwork.org/queries/2/edit", - "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/queries/a27178b9-45c3-4844-8ebf-ebd5da74a1e3" - } - }, + "_links": {"self": {"href": f"{self.api_url}/queries/fake_id"}}, }, ] }, } self.fake_query = { - "identifiers": ["action_network:a4dde5b6-0512-48ea-b4ad-63a71117b43d"], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", "name": "All donors", "browser_url": "https://actionnetwork.org/queries/1/edit", "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/queries/a4dde5b6-0512-48ea-b4ad-63a71117b43d" - }, + "self": {"href": f"{self.api_url}/queries/fake_id"}, "curies": [ { "name": "osdi", @@ -3254,16 +3017,10 @@ def setUp(self, m): "page": 1, "total_records": 2500, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/petitions/9f837109-710d-442f-8a99-857a21f36d25/signatures" - }, + "self": {"href": f"{self.api_url}/petitions/fake_id/signatures"}, "osdi:signatures": [ - { - "href": "https://actionnetwork.org/api/v2/petitions/9f837109-710d-442f-8a99-857a21f36d25/signatures/d6bdf50e-c3a4-4981-a948-3d8c086066d7" - }, - { - "href": "https://actionnetwork.org/api/v2/petitions/9f837109-710d-442f-8a99-857a21f36d25/signatures/71497ab2-b3e7-4896-af46-126ac7287dab" - }, + {"href": f"{self.api_url}/petitions/fake_id/signatures/fake_id"}, + {"href": f"{self.api_url}/petitions/fake_id/signatures/fake_id`"}, ], "curies": [ { @@ -3281,23 +3038,19 @@ def setUp(self, m): "_embedded": { "osdi:signatures": [ { - "identifiers": [ - "action_network:d6bdf50e-c3a4-4981-a948-3d8c086066d7" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-26T18:04:00Z", "modified_date": "2014-03-26T18:04:00Z", "action_network:person_id": "699da712-929f-11e3-a2e9-12313d316c29", - "action_network:petition_id": "9f837109-710d-442f-8a99-857a21f36d25", + "action_network:petition_id": "fake_id", "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/petitions/9f837109-710d-442f-8a99-857a21f36d25/signatures/d6bdf50e-c3a4-4981-a948-3d8c086066d7" + "href": f"{self.api_url}/petitions/fake_id/signatures/fake_id" }, "osdi:petition": { - "href": "https://actionnetwork.org/api/v2/petitions/9f837109-710d-442f-8a99-857a21f36d25" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/699da712-929f-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/petitions/fake_id" }, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, }, }, { @@ -3307,38 +3060,34 @@ def setUp(self, m): "created_date": "2014-03-26T16:07:10Z", "modified_date": "2014-03-26T16:07:10Z", "comments": "Stop doing the thing", - "action_network:person_id": "c945d6fe-929e-11e3-a2e9-12313d316c29", - "action_network:petition_id": "9f837109-710d-442f-8a99-857a21f36d25", + "action_network:person_id": "fake_id", + "action_network:petition_id": "fake_id", "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/petitions/9f837109-710d-442f-8a99-857a21f36d25/signatures/71497ab2-b3e7-4896-af46-126ac7287dab" + "href": f"{self.api_url}/petitions/fake_id/signatures/fake_id" }, "osdi:petition": { - "href": "https://actionnetwork.org/api/v2/petitions/9f837109-710d-442f-8a99-857a21f36d25" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/petitions/fake_id" }, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, }, }, ] }, } self.fake_signature = { - "identifiers": ["action_network:d6bdf50e-c3a4-4981-a948-3d8c086066d7"], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-26T18:04:00Z", "modified_date": "2014-03-26T18:04:00Z", "action_network:person_id": "699da712-929f-11e3-a2e9-12313d316c29", - "action_network:petition_id": "9f837109-710d-442f-8a99-857a21f36d25", + "action_network:petition_id": "fake_id", "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/petitions/9f837109-710d-442f-8a99-857a21f36d25/signatures/d6bdf50e-c3a4-4981-a948-3d8c086066d7" - }, - "osdi:petition": { - "href": "https://actionnetwork.org/api/v2/petitions/9f837109-710d-442f-8a99-857a21f36d25" + "href": f"{self.api_url}/petitions/fake_id/signatures/fake_id" }, + "osdi:petition": {"href": f"{self.api_url}/petitions/fake_id"}, "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/699da712-929f-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/people/699da712-929f-11e3-a2e9-12313d316c29" }, "curies": [ { @@ -3362,16 +3111,10 @@ def setUp(self, m): "page": 1, "total_records": 4, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86/submissions" - }, + "self": {"href": f"{self.api_url}/forms/fake_id/submissions"}, "osdi:submissions": [ - { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86/submissions/c851b31b-291e-4503-b8ea-e51a740e6e56" - }, - { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86/submissions/32dc6359-76fd-4e97-aef7-f053a4fcc550" - }, + {"href": f"{self.api_url}/forms/fake_id/submissions/fake_id"}, + {"href": f"{self.api_url}/forms/fake_id/submissions/fake_id"}, ], "curies": [ { @@ -3389,65 +3132,49 @@ def setUp(self, m): "_embedded": { "osdi:submissions": [ { - "identifiers": [ - "action_network:c851b31b-291e-4503-b8ea-e51a740e6e56" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-25T15:26:45Z", "modified_date": "2014-03-25T15:26:46Z", - "action:person_id": "d3e27e15-e5b5-4707-be96-8bc359462133", - "action_network:form_id": "adb951cb-51f9-420e-b7e6-de953195ec86", + "action:person_id": "fake_id", + "action_network:form_id": "fake_id", "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86/submissions/c851b31b-291e-4503-b8ea-e51a740e6e56" - }, - "osdi:form": { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/d3e27e15-e5b5-4707-be96-8bc359462133" + "href": f"{self.api_url}/forms/fake_id/submissions/fake_id" }, + "osdi:form": {"href": f"{self.api_url}/forms/fake_id"}, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, }, }, { "identifiers": [ - "action_network:4bf4254a-9411-4028-8cb7-a7d3ade5edea", + "action_network:fake_id", "free_forms:1", ], "created_date": "2014-03-24T17:00:42Z", "modified_date": "2014-03-24T17:00:42Z", - "action:person_id": "c945d6fe-929e-11e3-a2e9-12313d316c29", - "action_network:form_id": "adb951cb-51f9-420e-b7e6-de953195ec86", + "action:person_id": "fake_id", + "action_network:form_id": "fake_id", "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86/submissions/4bf4254a-9411-4028-8cb7-a7d3ade5edea" - }, - "osdi:form": { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/c945d6fe-929e-11e3-a2e9-12313d316c29" + "href": f"{self.api_url}/forms/fake_id/submissions/fake_id" }, + "osdi:form": {"href": f"{self.api_url}/forms/fake_id"}, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, }, }, ] }, } self.fake_submission = { - "identifiers": ["action_network:c851b31b-291e-4503-b8ea-e51a740e6e56"], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-25T15:26:45Z", "modified_date": "2014-03-25T15:26:46Z", - "action:person_id": "d3e27e15-e5b5-4707-be96-8bc359462133", - "action_network:form_id": "adb951cb-51f9-420e-b7e6-de953195ec86", + "action:person_id": "fake_id", + "action_network:form_id": "fake_id", "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86/submissions/c851b31b-291e-4503-b8ea-e51a740e6e56" - }, - "osdi:form": { - "href": "https://actionnetwork.org/api/v2/forms/adb951cb-51f9-420e-b7e6-de953195ec86" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/d3e27e15-e5b5-4707-be96-8bc359462133" - }, + "self": {"href": f"{self.api_url}/forms/fake_id/submissions/fake_id"}, + "osdi:form": {"href": f"{self.api_url}/forms/fake_id"}, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, "curies": [ { "name": "osdi", @@ -3470,15 +3197,11 @@ def setUp(self, m): "page": 1, "total_records": 243, "_links": { - "next": {"href": "https://actionnetwork.org/api/v2/tags?page=2"}, - "self": {"href": "https://actionnetwork.org/api/v2/tags"}, + "next": {"href": f"{self.api_url}/tags?page=2"}, + "self": {"href": f"{self.api_url}/tags"}, "osdi:tags": [ - { - "href": "https://actionnetwork.org/api/v2/tags/71f8feef-61c8-4e6b-9745-ec1d7752f298" - }, - { - "href": "https://actionnetwork.org/api/v2/tags/fc0a1ec6-5743-4b98-ae0c-cea8766b2212" - }, + {"href": f"{self.api_url}/tags/fake_id"}, + {"href": f"{self.api_url}/tags/fake_id"}, ], "curies": [ { @@ -3496,34 +3219,26 @@ def setUp(self, m): "_embedded": { "osdi:tags": [ { - "identifiers": [ - "action_network:71f8feef-61c8-4e6b-9745-ec1d7752f298" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-25T17:11:33Z", "modified_date": "2014-03-25T17:13:33Z", "name": "Volunteers", "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/tags/71f8feef-61c8-4e6b-9745-ec1d7752f298" - }, + "self": {"href": f"{self.api_url}/tags/fake_id"}, "osdi:taggings": { - "href": "https://actionnetwork.org/api/v2/tags/71f8feef-61c8-4e6b-9745-ec1d7752f298/taggings" + "href": f"{self.api_url}/tags/fake_id/taggings" }, }, }, { - "identifiers": [ - "action_network:fc0a1ec6-5743-4b98-ae0c-cea8766b2212" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-24T18:26:42Z", "modified_date": "2014-03-24T18:27:17Z", "name": "Economic Justice", "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/tags/fc0a1ec6-5743-4b98-ae0c-cea8766b2212" - }, + "self": {"href": f"{self.api_url}/tags/fake_id"}, "osdi:taggings": { - "href": "https://actionnetwork.org/api/v2/tags/fc0a1ec6-5743-4b98-ae0c-cea8766b2212/taggings" + "href": f"{self.api_url}/tags/fake_id/taggings" }, }, }, @@ -3538,19 +3253,11 @@ def setUp(self, m): "page": 1, "total_records": 123, "_links": { - "next": { - "href": "https://actionnetwork.org/api/v2/tags/71f8feef-61c8-4e6b-9745-ec1d7752f298/taggings?page=2" - }, - "self": { - "href": "https://actionnetwork.org/api/v2/tags/71f8feef-61c8-4e6b-9745-ec1d7752f298/taggings" - }, + "next": {"href": f"{self.api_url}/tags/fake_id/taggings?page=2"}, + "self": {"href": f"{self.api_url}/tags/fake_id/taggings"}, "osdi:taggings": [ - { - "href": "https://actionnetwork.org/api/v2/tags/71f8feef-61c8-4e6b-9745-ec1d7752f298/taggings/82e909f9-1ac7-4952-bbd4-b4690a14bec2" - }, - { - "href": "https://actionnetwork.org/api/v2/tags/71f8feef-61c8-4e6b-9745-ec1d7752f298/taggings/a9ccd87c-97f4-48db-9e6b-507509091839" - }, + {"href": f"{self.api_url}/tags/fake_id/taggings/fake_id"}, + {"href": f"{self.api_url}/tags/fake_id/taggings/fake_id"}, ], "curies": [ { @@ -3570,18 +3277,12 @@ def setUp(self, m): { "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/tags/71f8feef-61c8-4e6b-9745-ec1d7752f298/taggings/82e909f9-1ac7-4952-bbd4-b4690a14bec2" - }, - "osdi:tag": { - "href": "https://actionnetwork.org/api/v2/tags/71f8feef-61c8-4e6b-9745-ec1d7752f298" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/82e909f9-1ac7-4952-bbd4-b4690a14bec2" + "href": f"{self.api_url}/tags/fake_id/taggings/fake_id" }, + "osdi:tag": {"href": f"{self.api_url}/tags/fake_id"}, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, }, - "identifiers": [ - "action_network:82e909f9-1ac7-4952-bbd4-b4690a14bec2" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-18T22:25:31Z", "modified_date": "2014-03-18T22:25:38Z", "item_type": "osdi:person", @@ -3589,18 +3290,12 @@ def setUp(self, m): { "_links": { "self": { - "href": "https://actionnetwork.org/api/v2/tags/71f8feef-61c8-4e6b-9745-ec1d7752f298/taggings/a9ccd87c-97f4-48db-9e6b-507509091839" - }, - "osdi:tag": { - "href": "https://actionnetwork.org/api/v2/tags/71f8feef-61c8-4e6b-9745-ec1d7752f298" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/a9ccd87c-97f4-48db-9e6b-507509091839" + "href": f"{self.api_url}/tags/fake_id/taggings/fake_id" }, + "osdi:tag": {"href": f"{self.api_url}/tags/fake_id"}, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, }, - "identifiers": [ - "action_network:a9ccd87c-97f4-48db-9e6b-507509091839" - ], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-18T22:24:24Z", "modified_date": "2014-03-18T22:24:24Z", "item_type": "osdi:person", @@ -3610,15 +3305,9 @@ def setUp(self, m): } self.fake_tagging = { "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/tags/71f8feef-61c8-4e6b-9745-ec1d7752f298/taggings/82e909f9-1ac7-4952-bbd4-b4690a14bec2" - }, - "osdi:tag": { - "href": "https://actionnetwork.org/api/v2/tags/71f8feef-61c8-4e6b-9745-ec1d7752f298" - }, - "osdi:person": { - "href": "https://actionnetwork.org/api/v2/people/82e909f9-1ac7-4952-bbd4-b4690a14bec2" - }, + "self": {"href": f"{self.api_url}/tags/fake_id/taggings/fake_id"}, + "osdi:tag": {"href": f"{self.api_url}/tags/fake_id"}, + "osdi:person": {"href": f"{self.api_url}/people/fake_id"}, "curies": [ { "name": "osdi", @@ -3632,7 +3321,7 @@ def setUp(self, m): }, ], }, - "identifiers": ["action_network:82e909f9-1ac7-4952-bbd4-b4690a14bec2"], + "identifiers": ["action_network:fake_id"], "created_date": "2014-03-18T22:25:31Z", "modified_date": "2014-03-18T22:25:38Z", "item_type": "osdi:person", @@ -3645,15 +3334,11 @@ def setUp(self, m): "page": 1, "total_records": 162, "_links": { - "next": {"href": "https://actionnetwork.org/api/v2/wrappers?page=2"}, - "self": {"href": "https://actionnetwork.org/api/v2/wrappers"}, + "next": {"href": f"{self.api_url}/wrappers?page=2"}, + "self": {"href": f"{self.api_url}/wrappers"}, "osdi:wrappers": [ - { - "href": "https://actionnetwork.org/api/v2/wrappers/a4dde5b6-0512-48ea-b4ad-63a71117b43d" - }, - { - "href": "https://actionnetwork.org/api/v2/wrappers/a27178b9-45c3-4844-8ebf-ebd5da74a1e3" - }, + {"href": f"{self.api_url}/wrappers/fake_id"}, + {"href": f"{self.api_url}/wrappers/fake_id"}, ], "curies": [ { @@ -3671,63 +3356,104 @@ def setUp(self, m): "_embedded": { "osdi:wrappers": [ { - "identifiers": [ - "action_network:a4dde5b6-0512-48ea-b4ad-63a71117b43d" - ], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", "name": "Default wrapper -- logo only", "administrative_url": "https://actionnetwork.org/wrappers/1/edit", - "header": '\r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n
\r\n
\r\n', - "footer": "\r\n
\r\n
\r\n
", + "header": '\r\n' + ' \r\n \r\n " + " \r\n
\r\n \r\n \r\n ' + ' \r\n " + " \r\n " + "
\r\n ' + '
\r\n' + '', + "footer": "\r\n
\r\n " + "
\r\n " + "
", "action_network:suffix": " via ProgressivePower.org", "wrapper_type": "email", "default": True, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/wrappers/a4dde5b6-0512-48ea-b4ad-63a71117b43d" - } + "self": {"href": f"{self.api_url}/wrappers/fake_id"} }, }, { - "identifiers": [ - "action_network:a27178b9-45c3-4844-8ebf-ebd5da74a1e3" - ], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-03-14T15:21:05Z", "modified_date": "2014-03-17T19:56:11Z", "name": "No logo", "administrative_url": "https://actionnetwork.org/wrappers/2/edit", - "header": '\r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n
\r\n
\r\n', - "footer": "\r\n
\r\n
\r\n
", + "header": '\r\n \r\n ' + '\r\n " + " \r\n
\r\n ' + ' \r\n ' + " \r\n " + ' \r\n " + " \r\n
\r\n ' + '
\r\n', + "footer": "\r\n
\r\n " + "
\r\n " + "
", "wrapper_type": "email", "default": False, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/wrappers/a27178b9-45c3-4844-8ebf-ebd5da74a1e3" - } + "self": {"href": f"{self.api_url}/wrappers/fake_id"} }, }, ] }, } self.fake_wrapper = { - "identifiers": ["action_network:a4dde5b6-0512-48ea-b4ad-63a71117b43d"], + "identifiers": ["action_network:fake_id"], "origin_system": "Action Network", "created_date": "2014-03-24T18:03:45Z", "modified_date": "2014-03-25T15:00:22Z", "name": "Default wrapper -- logo only", "administrative_url": "https://actionnetwork.org/wrappers/1/edit", - "header": '\r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n
\r\n
\r\n', - "footer": "\r\n
\r\n
\r\n
", + "header": '\r\n' + " \r\n" + ' \r\n " + " \r\n
\r\n ' + ' \r\n \r\n ' + ' \r\n" + " \r\n" + "
\r\n ' + '
\r\n' + '', + "footer": "\r\n
\r\n" + "
\r\n" + "
", "action_network:suffix": " via ProgressivePower.org", "wrapper_type": "email", "default": True, "_links": { - "self": { - "href": "https://actionnetwork.org/api/v2/wrappers/a4dde5b6-0512-48ea-b4ad-63a71117b43d" - }, + "self": {"href": f"{self.api_url}/wrappers/fake_id"}, "curies": [ { "name": "osdi",