mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-05 01:11:55 +02:00
Comments
This commit is contained in:
parent
8d324a81d1
commit
bfbce5a5c5
2 changed files with 36 additions and 2 deletions
|
@ -149,6 +149,10 @@ class Command(BaseCommand):
|
|||
TerminalHelper.colorful_logger(logger.warning, TerminalColors.YELLOW, message)
|
||||
|
||||
def _update_existing_suborganizations(self, portfolio, orgs_to_update):
|
||||
"""
|
||||
Update existing suborganizations with new portfolio.
|
||||
Prompts for user confirmation before proceeding.
|
||||
"""
|
||||
proceed = TerminalHelper.prompt_for_execution(
|
||||
system_exit_on_terminate=False,
|
||||
info_to_inspect=f"""Some suborganizations already exist in our DB.
|
||||
|
@ -170,8 +174,10 @@ class Command(BaseCommand):
|
|||
TerminalHelper.colorful_logger(logger.info, TerminalColors.MAGENTA, message)
|
||||
|
||||
def _update_portfolio_location_details(self, portfolio: Portfolio, domain_info: DomainInformation):
|
||||
"""Adds location information to the given portfolio based off of the values in
|
||||
DomainInformation"""
|
||||
"""
|
||||
Update portfolio location details based on DomainInformation.
|
||||
Copies relevant fields and saves the portfolio.
|
||||
"""
|
||||
location_props = [
|
||||
"address_line1",
|
||||
"address_line2",
|
||||
|
@ -191,6 +197,10 @@ class Command(BaseCommand):
|
|||
TerminalHelper.colorful_logger(logger.info, TerminalColors.OKGREEN, message)
|
||||
|
||||
def handle_portfolio_requests(self, portfolio: Portfolio, federal_agency: FederalAgency):
|
||||
"""
|
||||
Associate portfolio with domain requests for a federal agency.
|
||||
Updates all relevant domain request records.
|
||||
"""
|
||||
domain_requests = DomainInformation.objects.filter(federal_agency=federal_agency)
|
||||
if len(domain_requests) < 1:
|
||||
message = "Portfolios not added to domain requests: no valid records found"
|
||||
|
@ -205,6 +215,10 @@ class Command(BaseCommand):
|
|||
TerminalHelper.colorful_logger(logger.info, TerminalColors.OKGREEN, message)
|
||||
|
||||
def handle_portfolio_domains(self, portfolio: Portfolio, federal_agency: FederalAgency):
|
||||
"""
|
||||
Associate portfolio with domains for a federal agency.
|
||||
Updates all relevant domain information records.
|
||||
"""
|
||||
domain_infos = DomainInformation.objects.filter(federal_agency=federal_agency)
|
||||
|
||||
if len(domain_infos) < 1:
|
||||
|
|
|
@ -1408,3 +1408,23 @@ class TestPopulateFederalAgencyInitialsAndFceb(TestCase):
|
|||
missing_agency.refresh_from_db()
|
||||
self.assertIsNone(missing_agency.initials)
|
||||
self.assertIsNone(missing_agency.is_fceb)
|
||||
|
||||
|
||||
class TestCreateFederalPortfolio(TestCase):
|
||||
def setUp(self):
|
||||
self.csv_path = "registrar/tests/data/fake_federal_cio.csv"
|
||||
|
||||
# Create test FederalAgency objects
|
||||
self.agency1, _ = FederalAgency.objects.get_or_create(agency="American Battle Monuments Commission")
|
||||
self.agency2, _ = FederalAgency.objects.get_or_create(agency="Advisory Council on Historic Preservation")
|
||||
self.agency3, _ = FederalAgency.objects.get_or_create(agency="AMTRAK")
|
||||
self.agency4, _ = FederalAgency.objects.get_or_create(agency="John F. Kennedy Center for Performing Arts")
|
||||
|
||||
def tearDown(self):
|
||||
SeniorOfficial.objects.all().delete()
|
||||
FederalAgency.objects.all().delete()
|
||||
|
||||
# == create_or_modify_portfolio tests == #
|
||||
# == create_suborganizations tests == #
|
||||
# == handle_portfolio_requests tests == #
|
||||
# == handle_portfolio_domains tests == #
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue