Skip to content

Commit

Permalink
Merge pull request #8711 from cfpb/fix/pfc-notification-test
Browse files Browse the repository at this point in the history
Fix invalid paying_for_college test
  • Loading branch information
chosak authored Jan 10, 2025
2 parents 0a0358e + a34a777 commit 34e84f0
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cfgov/paying_for_college/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def create_school(
state="OZ",
ope6=5555,
ope8=555500,
settlement_school="",
):
return School.objects.create(
school_id=school_id,
Expand All @@ -74,6 +75,7 @@ def create_school(
state=state,
ope6_id=ope6,
ope8_id=ope8,
settlement_school=settlement_school,
)

def create_alias(self, alias, school):
Expand Down Expand Up @@ -142,18 +144,24 @@ def test_school_related_models(self):
self.assertTrue(s.convert_ope6() == "")
self.assertTrue(s.convert_ope8() == "")

@mock.patch("paying_for_college.models.disclosures.requests.get")
@mock.patch("paying_for_college.models.disclosures.requests.post")
def test_notification_request(self, mock_requests):
contact = self.create_contact()
unicode_endpoint = "http://unicode.contact.com"
contact.endpoint = unicode_endpoint
contact.save()
school = self.create_school()
school = self.create_school(settlement_school="settlement")
school.contact = contact
notification = self.create_notification(school)
notification.notify_school()
self.assertTrue(
mock_requests.called_with, unicode_endpoint.encode("utf-8")
mock_requests.assert_called_with(
unicode_endpoint.encode("utf-8"),
data={
"oid": notification.oid,
"time": notification.timestamp.isoformat(),
"errors": "none",
},
timeout=10,
)

def test_constant_models(self):
Expand Down

0 comments on commit 34e84f0

Please sign in to comment.