Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalid paying_for_college test #8711

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading