From d632d3b4b8189fd5c0b29e024d4a5e57f01f3a23 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Mon, 11 Nov 2024 13:16:46 -0500 Subject: [PATCH 1/2] Include location name in member address export resolves #838 --- mep/accounts/management/commands/export_addresses.py | 1 + mep/accounts/tests/test_accounts_commands.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/mep/accounts/management/commands/export_addresses.py b/mep/accounts/management/commands/export_addresses.py index cb895882..9b27f866 100644 --- a/mep/accounts/management/commands/export_addresses.py +++ b/mep/accounts/management/commands/export_addresses.py @@ -95,6 +95,7 @@ def get_object_data(self, obj): care_of_person_id=obj.care_of_person.slug if obj.care_of_person else None, care_of_person_name=obj.care_of_person.name if obj.care_of_person else None, # Location data + location_name=loc.name.strip(), street_address=loc.street_address, city=loc.city, postal_code=loc.postal_code, diff --git a/mep/accounts/tests/test_accounts_commands.py b/mep/accounts/tests/test_accounts_commands.py index 8ae9dddc..4e56c628 100644 --- a/mep/accounts/tests/test_accounts_commands.py +++ b/mep/accounts/tests/test_accounts_commands.py @@ -684,3 +684,6 @@ def test_get_object_data(self): assert gay_data["members"][0]["sort_name"] == "Gay, Francisque" assert gay_data["care_of_person_id"] == "hemingway" assert gay_data["care_of_person_name"] == "Ernest Hemingway" + + # with location name + # TODO! From 9353156fa2f10444d025594638a0acec569b50d9 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Thu, 14 Nov 2024 15:17:23 -0500 Subject: [PATCH 2/2] Test location name included in address export --- mep/accounts/tests/test_accounts_commands.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mep/accounts/tests/test_accounts_commands.py b/mep/accounts/tests/test_accounts_commands.py index 4e56c628..875f54c6 100644 --- a/mep/accounts/tests/test_accounts_commands.py +++ b/mep/accounts/tests/test_accounts_commands.py @@ -670,6 +670,8 @@ def test_get_object_data(self): assert gay_data["start_date"] == "1919-01-01" assert gay_data["end_date"] == "1930-01-01" assert gay_data["care_of_person_id"] == "hemingway" + # location does not have a name + assert gay_data["location_name"] == "" # without dates self.cmd.include_dates = False @@ -685,5 +687,9 @@ def test_get_object_data(self): assert gay_data["care_of_person_id"] == "hemingway" assert gay_data["care_of_person_name"] == "Ernest Hemingway" - # with location name - # TODO! + # add a location name to confirm it is included + loc = address.location + loc.name = "Le Hotel" + loc.save() + gay_data = self.cmd.get_object_data(address) + assert gay_data["location_name"] == loc.name