mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-18 02:19:23 +02:00
Delete tests for deprecated field updated_federal_agency
This commit is contained in:
parent
f9eb4746a1
commit
98e61d606d
4 changed files with 2 additions and 321 deletions
|
@ -18,6 +18,7 @@ from registrar.models.contact import Contact
|
||||||
from registrar.models.domain_request import DomainRequest
|
from registrar.models.domain_request import DomainRequest
|
||||||
from registrar.models.domain_information import DomainInformation
|
from registrar.models.domain_information import DomainInformation
|
||||||
from registrar.models.user import User
|
from registrar.models.user import User
|
||||||
|
from registrar.models.federal_agency import FederalAgency
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -819,7 +820,7 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
valid_org_choices = [(name, value) for name, value in DomainRequest.OrganizationChoices.choices]
|
valid_org_choices = [(name, value) for name, value in DomainRequest.OrganizationChoices.choices]
|
||||||
valid_fed_choices = [value for name, value in DomainRequest.BranchChoices.choices]
|
valid_fed_choices = [value for name, value in DomainRequest.BranchChoices.choices]
|
||||||
valid_agency_choices = DomainRequest.AGENCIES
|
valid_agency_choices = FederalAgency.objects.all()
|
||||||
# ======================================================
|
# ======================================================
|
||||||
# ================= DOMAIN INFORMATION =================
|
# ================= DOMAIN INFORMATION =================
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|
|
@ -220,207 +220,6 @@ class DomainRequest(TimeStampedModel):
|
||||||
JUDICIAL = "judicial", "Judicial"
|
JUDICIAL = "judicial", "Judicial"
|
||||||
LEGISLATIVE = "legislative", "Legislative"
|
LEGISLATIVE = "legislative", "Legislative"
|
||||||
|
|
||||||
AGENCIES = [
|
|
||||||
"Administrative Conference of the United States",
|
|
||||||
"Advisory Council on Historic Preservation",
|
|
||||||
"American Battle Monuments Commission",
|
|
||||||
"AMTRAK",
|
|
||||||
"Appalachian Regional Commission",
|
|
||||||
("Appraisal Subcommittee of the Federal Financial " "Institutions Examination Council"),
|
|
||||||
"Appraisal Subcommittee",
|
|
||||||
"Architect of the Capitol",
|
|
||||||
"Armed Forces Retirement Home",
|
|
||||||
"Barry Goldwater Scholarship and Excellence in Education Foundation",
|
|
||||||
"Barry Goldwater Scholarship and Excellence in Education Program",
|
|
||||||
"Central Intelligence Agency",
|
|
||||||
"Chemical Safety Board",
|
|
||||||
"Christopher Columbus Fellowship Foundation",
|
|
||||||
"Civil Rights Cold Case Records Review Board",
|
|
||||||
"Commission for the Preservation of America's Heritage Abroad",
|
|
||||||
"Commission of Fine Arts",
|
|
||||||
"Committee for Purchase From People Who Are Blind or Severely Disabled",
|
|
||||||
"Commodity Futures Trading Commission",
|
|
||||||
"Congressional Budget Office",
|
|
||||||
"Consumer Financial Protection Bureau",
|
|
||||||
"Consumer Product Safety Commission",
|
|
||||||
"Corporation for National & Community Service",
|
|
||||||
"Corporation for National and Community Service",
|
|
||||||
"Council of Inspectors General on Integrity and Efficiency",
|
|
||||||
"Court Services and Offender Supervision",
|
|
||||||
"Cyberspace Solarium Commission",
|
|
||||||
"DC Court Services and Offender Supervision Agency",
|
|
||||||
"DC Pre-trial Services",
|
|
||||||
"Defense Nuclear Facilities Safety Board",
|
|
||||||
"Delta Regional Authority",
|
|
||||||
"Denali Commission",
|
|
||||||
"Department of Agriculture",
|
|
||||||
"Department of Commerce",
|
|
||||||
"Department of Defense",
|
|
||||||
"Department of Education",
|
|
||||||
"Department of Energy",
|
|
||||||
"Department of Health and Human Services",
|
|
||||||
"Department of Homeland Security",
|
|
||||||
"Department of Housing and Urban Development",
|
|
||||||
"Department of Justice",
|
|
||||||
"Department of Labor",
|
|
||||||
"Department of State",
|
|
||||||
"Department of the Interior",
|
|
||||||
"Department of the Treasury",
|
|
||||||
"Department of Transportation",
|
|
||||||
"Department of Veterans Affairs",
|
|
||||||
"Director of National Intelligence",
|
|
||||||
"Dwight D. Eisenhower Memorial Commission",
|
|
||||||
"Election Assistance Commission",
|
|
||||||
"Environmental Protection Agency",
|
|
||||||
"Equal Employment Opportunity Commission",
|
|
||||||
"Executive Office of the President",
|
|
||||||
"Export-Import Bank of the United States",
|
|
||||||
"Export/Import Bank of the U.S.",
|
|
||||||
"Farm Credit Administration",
|
|
||||||
"Farm Credit System Insurance Corporation",
|
|
||||||
"Federal Communications Commission",
|
|
||||||
"Federal Deposit Insurance Corporation",
|
|
||||||
"Federal Election Commission",
|
|
||||||
"Federal Energy Regulatory Commission",
|
|
||||||
"Federal Financial Institutions Examination Council",
|
|
||||||
"Federal Housing Finance Agency",
|
|
||||||
"Federal Judiciary",
|
|
||||||
"Federal Labor Relations Authority",
|
|
||||||
"Federal Maritime Commission",
|
|
||||||
"Federal Mediation and Conciliation Service",
|
|
||||||
"Federal Mine Safety and Health Review Commission",
|
|
||||||
"Federal Permitting Improvement Steering Council",
|
|
||||||
"Federal Reserve Board of Governors",
|
|
||||||
"Federal Reserve System",
|
|
||||||
"Federal Trade Commission",
|
|
||||||
"General Services Administration",
|
|
||||||
"gov Administration",
|
|
||||||
"Government Accountability Office",
|
|
||||||
"Government Publishing Office",
|
|
||||||
"Gulf Coast Ecosystem Restoration Council",
|
|
||||||
"Harry S Truman Scholarship Foundation",
|
|
||||||
"Harry S. Truman Scholarship Foundation",
|
|
||||||
"Institute of Museum and Library Services",
|
|
||||||
"Institute of Peace",
|
|
||||||
"Inter-American Foundation",
|
|
||||||
"International Boundary and Water Commission: United States and Mexico",
|
|
||||||
"International Boundary Commission: United States and Canada",
|
|
||||||
"International Joint Commission: United States and Canada",
|
|
||||||
"James Madison Memorial Fellowship Foundation",
|
|
||||||
"Japan-United States Friendship Commission",
|
|
||||||
"Japan-US Friendship Commission",
|
|
||||||
"John F. Kennedy Center for Performing Arts",
|
|
||||||
"John F. Kennedy Center for the Performing Arts",
|
|
||||||
"Legal Services Corporation",
|
|
||||||
"Legislative Branch",
|
|
||||||
"Library of Congress",
|
|
||||||
"Marine Mammal Commission",
|
|
||||||
"Medicaid and CHIP Payment and Access Commission",
|
|
||||||
"Medical Payment Advisory Commission",
|
|
||||||
"Medicare Payment Advisory Commission",
|
|
||||||
"Merit Systems Protection Board",
|
|
||||||
"Millennium Challenge Corporation",
|
|
||||||
"Morris K. Udall and Stewart L. Udall Foundation",
|
|
||||||
"National Aeronautics and Space Administration",
|
|
||||||
"National Archives and Records Administration",
|
|
||||||
"National Capital Planning Commission",
|
|
||||||
"National Council on Disability",
|
|
||||||
"National Credit Union Administration",
|
|
||||||
"National Endowment for the Arts",
|
|
||||||
"National Endowment for the Humanities",
|
|
||||||
"National Foundation on the Arts and the Humanities",
|
|
||||||
"National Gallery of Art",
|
|
||||||
"National Indian Gaming Commission",
|
|
||||||
"National Labor Relations Board",
|
|
||||||
"National Mediation Board",
|
|
||||||
"National Science Foundation",
|
|
||||||
"National Security Commission on Artificial Intelligence",
|
|
||||||
"National Transportation Safety Board",
|
|
||||||
"Networking Information Technology Research and Development",
|
|
||||||
"Non-Federal Agency",
|
|
||||||
"Northern Border Regional Commission",
|
|
||||||
"Nuclear Regulatory Commission",
|
|
||||||
"Nuclear Safety Oversight Committee",
|
|
||||||
"Nuclear Waste Technical Review Board",
|
|
||||||
"Occupational Safety & Health Review Commission",
|
|
||||||
"Occupational Safety and Health Review Commission",
|
|
||||||
"Office of Compliance",
|
|
||||||
"Office of Congressional Workplace Rights",
|
|
||||||
"Office of Government Ethics",
|
|
||||||
"Office of Navajo and Hopi Indian Relocation",
|
|
||||||
"Office of Personnel Management",
|
|
||||||
"Open World Leadership Center",
|
|
||||||
"Overseas Private Investment Corporation",
|
|
||||||
"Peace Corps",
|
|
||||||
"Pension Benefit Guaranty Corporation",
|
|
||||||
"Postal Regulatory Commission",
|
|
||||||
"Presidio Trust",
|
|
||||||
"Privacy and Civil Liberties Oversight Board",
|
|
||||||
"Public Buildings Reform Board",
|
|
||||||
"Public Defender Service for the District of Columbia",
|
|
||||||
"Railroad Retirement Board",
|
|
||||||
"Securities and Exchange Commission",
|
|
||||||
"Selective Service System",
|
|
||||||
"Small Business Administration",
|
|
||||||
"Smithsonian Institution",
|
|
||||||
"Social Security Administration",
|
|
||||||
"Social Security Advisory Board",
|
|
||||||
"Southeast Crescent Regional Commission",
|
|
||||||
"Southwest Border Regional Commission",
|
|
||||||
"State Justice Institute",
|
|
||||||
"State, Local, and Tribal Government",
|
|
||||||
"Stennis Center for Public Service",
|
|
||||||
"Surface Transportation Board",
|
|
||||||
"Tennessee Valley Authority",
|
|
||||||
"The Executive Office of the President",
|
|
||||||
"The Intelligence Community",
|
|
||||||
"The Legislative Branch",
|
|
||||||
"The Supreme Court",
|
|
||||||
"The United States World War One Centennial Commission",
|
|
||||||
"U.S. Access Board",
|
|
||||||
"U.S. Agency for Global Media",
|
|
||||||
"U.S. Agency for International Development",
|
|
||||||
"U.S. Capitol Police",
|
|
||||||
"U.S. Chemical Safety Board",
|
|
||||||
"U.S. China Economic and Security Review Commission",
|
|
||||||
"U.S. Commission for the Preservation of Americas Heritage Abroad",
|
|
||||||
"U.S. Commission of Fine Arts",
|
|
||||||
"U.S. Commission on Civil Rights",
|
|
||||||
"U.S. Commission on International Religious Freedom",
|
|
||||||
"U.S. Courts",
|
|
||||||
"U.S. Department of Agriculture",
|
|
||||||
"U.S. Interagency Council on Homelessness",
|
|
||||||
"U.S. International Trade Commission",
|
|
||||||
"U.S. Nuclear Waste Technical Review Board",
|
|
||||||
"U.S. Office of Special Counsel",
|
|
||||||
"U.S. Peace Corps",
|
|
||||||
"U.S. Postal Service",
|
|
||||||
"U.S. Semiquincentennial Commission",
|
|
||||||
"U.S. Trade and Development Agency",
|
|
||||||
"U.S.-China Economic and Security Review Commission",
|
|
||||||
"Udall Foundation",
|
|
||||||
"United States AbilityOne",
|
|
||||||
"United States Access Board",
|
|
||||||
"United States African Development Foundation",
|
|
||||||
"United States Agency for Global Media",
|
|
||||||
"United States Arctic Research Commission",
|
|
||||||
"United States Global Change Research Program",
|
|
||||||
"United States Holocaust Memorial Museum",
|
|
||||||
"United States Institute of Peace",
|
|
||||||
"United States Interagency Council on Homelessness",
|
|
||||||
"United States International Development Finance Corporation",
|
|
||||||
"United States International Trade Commission",
|
|
||||||
"United States Postal Service",
|
|
||||||
"United States Senate",
|
|
||||||
"United States Trade and Development Agency",
|
|
||||||
"Utah Reclamation Mitigation and Conservation Commission",
|
|
||||||
"Vietnam Education Foundation",
|
|
||||||
"Western Hemisphere Drug Policy Commission",
|
|
||||||
"Woodrow Wilson International Center for Scholars",
|
|
||||||
"World War I Centennial Commission",
|
|
||||||
]
|
|
||||||
AGENCY_CHOICES = [(v, v) for v in AGENCIES]
|
|
||||||
|
|
||||||
class RejectionReasons(models.TextChoices):
|
class RejectionReasons(models.TextChoices):
|
||||||
DOMAIN_PURPOSE = "purpose_not_met", "Purpose requirements not met"
|
DOMAIN_PURPOSE = "purpose_not_met", "Purpose requirements not met"
|
||||||
REQUESTOR = "requestor_not_eligible", "Requestor not eligible to make request"
|
REQUESTOR = "requestor_not_eligible", "Requestor not eligible to make request"
|
||||||
|
|
|
@ -805,7 +805,6 @@ def completed_domain_request(
|
||||||
is_election_board=False,
|
is_election_board=False,
|
||||||
organization_type=None,
|
organization_type=None,
|
||||||
federal_agency=None,
|
federal_agency=None,
|
||||||
updated_federal_agency=None,
|
|
||||||
):
|
):
|
||||||
"""A completed domain request."""
|
"""A completed domain request."""
|
||||||
if not user:
|
if not user:
|
||||||
|
@ -861,7 +860,6 @@ def completed_domain_request(
|
||||||
status=status,
|
status=status,
|
||||||
investigator=investigator,
|
investigator=investigator,
|
||||||
federal_agency=federal_agency,
|
federal_agency=federal_agency,
|
||||||
updated_federal_agency=updated_federal_agency,
|
|
||||||
)
|
)
|
||||||
if has_about_your_organization:
|
if has_about_your_organization:
|
||||||
domain_request_kwargs["about_your_organization"] = "e-Government"
|
domain_request_kwargs["about_your_organization"] = "e-Government"
|
||||||
|
|
|
@ -841,120 +841,3 @@ class TestDiscloseEmails(MockEppLib):
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# TODO in #1793: Remove this whole test class
|
|
||||||
class TestPopulateDomainUpdatedFederalAgency(TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
super().setUp()
|
|
||||||
|
|
||||||
# Get the domain requests
|
|
||||||
self.domain_request_1 = completed_domain_request(
|
|
||||||
name="stitches.gov",
|
|
||||||
generic_org_type=DomainRequest.OrganizationChoices.FEDERAL,
|
|
||||||
is_election_board=True,
|
|
||||||
status=DomainRequest.DomainRequestStatus.IN_REVIEW,
|
|
||||||
federal_agency="U.S. Peace Corps",
|
|
||||||
)
|
|
||||||
self.domain_request_2 = completed_domain_request(
|
|
||||||
name="fadoesntexist.gov",
|
|
||||||
generic_org_type=DomainRequest.OrganizationChoices.FEDERAL,
|
|
||||||
is_election_board=True,
|
|
||||||
status=DomainRequest.DomainRequestStatus.IN_REVIEW,
|
|
||||||
federal_agency="MEOWARDRULES",
|
|
||||||
)
|
|
||||||
self.domain_request_3 = completed_domain_request(
|
|
||||||
name="nullfederalagency.gov",
|
|
||||||
generic_org_type=DomainRequest.OrganizationChoices.FEDERAL,
|
|
||||||
is_election_board=True,
|
|
||||||
status=DomainRequest.DomainRequestStatus.IN_REVIEW,
|
|
||||||
federal_agency=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Approve all three requests
|
|
||||||
self.domain_request_1.approve()
|
|
||||||
self.domain_request_2.approve()
|
|
||||||
self.domain_request_3.approve()
|
|
||||||
|
|
||||||
# Get the domains
|
|
||||||
self.domain_1 = Domain.objects.get(name="stitches.gov")
|
|
||||||
self.domain_2 = Domain.objects.get(name="fadoesntexist.gov")
|
|
||||||
self.domain_3 = Domain.objects.get(name="nullfederalagency.gov")
|
|
||||||
|
|
||||||
# Get the domain infos
|
|
||||||
self.domain_info_1 = DomainInformation.objects.get(domain=self.domain_1)
|
|
||||||
self.domain_info_2 = DomainInformation.objects.get(domain=self.domain_2)
|
|
||||||
self.domain_info_3 = DomainInformation.objects.get(domain=self.domain_3)
|
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
super().tearDown()
|
|
||||||
DomainInformation.objects.all().delete()
|
|
||||||
DomainRequest.objects.all().delete()
|
|
||||||
Domain.objects.all().delete()
|
|
||||||
|
|
||||||
def run_populate_domain_updated_federal_agency(self):
|
|
||||||
"""
|
|
||||||
This method executes the populate_domain_updated_federal_agency command.
|
|
||||||
|
|
||||||
The 'call_command' function from Django's management framework is then used to
|
|
||||||
execute the populate_domain_updated_federal_agency command.
|
|
||||||
"""
|
|
||||||
with less_console_noise():
|
|
||||||
call_command("populate_domain_updated_federal_agency")
|
|
||||||
|
|
||||||
def test_domain_information_renaming_federal_agency_success(self):
|
|
||||||
"""
|
|
||||||
Domain Information updates successfully for an "outdated" Federal Agency
|
|
||||||
"""
|
|
||||||
|
|
||||||
self.run_populate_domain_updated_federal_agency()
|
|
||||||
|
|
||||||
self.domain_info_1.refresh_from_db()
|
|
||||||
|
|
||||||
previous_federal_agency_name = self.domain_info_1.federal_agency
|
|
||||||
|
|
||||||
updated_federal_agency_name = self.domain_info_1.updated_federal_agency.agency
|
|
||||||
|
|
||||||
self.assertEqual(previous_federal_agency_name, "U.S. Peace Corps")
|
|
||||||
self.assertEqual(updated_federal_agency_name, "Peace Corps")
|
|
||||||
|
|
||||||
def test_domain_information_does_not_exist(self):
|
|
||||||
"""
|
|
||||||
Update a Federal Agency that doesn't exist
|
|
||||||
(should return None bc the Federal Agency didn't exist before)
|
|
||||||
"""
|
|
||||||
|
|
||||||
self.run_populate_domain_updated_federal_agency()
|
|
||||||
|
|
||||||
self.domain_info_2.refresh_from_db()
|
|
||||||
|
|
||||||
self.assertEqual(self.domain_info_2.updated_federal_agency, None)
|
|
||||||
|
|
||||||
def test_domain_request_is_skipped(self):
|
|
||||||
"""
|
|
||||||
Update a Domain Request that doesn't exist
|
|
||||||
(should return None bc the Federal Agency didn't exist before)
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Test case #2
|
|
||||||
self.run_populate_domain_updated_federal_agency()
|
|
||||||
|
|
||||||
self.domain_request_2.refresh_from_db()
|
|
||||||
|
|
||||||
self.assertEqual(self.domain_request_2.updated_federal_agency, None)
|
|
||||||
|
|
||||||
def test_domain_information_updating_null_federal_agency_to_non_federal_agency(self):
|
|
||||||
"""
|
|
||||||
Updating a Domain Information that was previously None
|
|
||||||
to Non-Federal Agency
|
|
||||||
"""
|
|
||||||
|
|
||||||
self.run_populate_domain_updated_federal_agency()
|
|
||||||
|
|
||||||
self.domain_info_3.refresh_from_db()
|
|
||||||
|
|
||||||
previous_federal_agency_name = self.domain_info_3.federal_agency
|
|
||||||
updated_federal_agency_name = self.domain_info_3.updated_federal_agency.agency
|
|
||||||
|
|
||||||
self.assertEqual(previous_federal_agency_name, None)
|
|
||||||
self.assertEqual(updated_federal_agency_name, "Non-Federal Agency")
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue