fix: Upgrade edx-django-utils, dropping newrelic; fix test and typo (#36799)

This upgrades edx-django-utils to a version that drops the newrelic
dependency. However, I also needed to fix a test that was sensitive to the
number of warnings that the code under test produced. With newrelic gone,
there's an additional warning.

- Fix test so that it isn't sensitive to unrelated warnings
- Fix typo in warning

For reference, this is the new warning:

```
"WARNING:edx_django_utils.monitoring.internal.backends:Could not load OPENEDX_TELEMETRY option 'edx_django_utils.monitoring.NewRelicBackend': Exception('Could not load New Relic monitoring backend; package not present.')"
```

This is expected due to edx-django-utils still defaulting to NR for
telemetry. (Perhaps the subject of a future breaking change.)
This commit is contained in:
Tim McCormack
2025-05-27 11:32:43 -04:00
committed by GitHub
parent c82490393d
commit 4856539b22
6 changed files with 6 additions and 22 deletions

View File

@@ -421,7 +421,7 @@ def _check_user_auth_flow(site, user):
# we don't record their e-mail in case there is sensitive info accidentally
# in there.
set_custom_attribute("login_tpa_domain_shortcircuit_user_id", user.id)
log.warning("User %s has nonstandard e-mail. Shortcircuiting THIRD_PART_AUTH_ONLY_DOMAIN check.", user.id)
log.warning("User %s has nonstandard e-mail. Shortcircuiting THIRD_PARTY_AUTH_ONLY_DOMAIN check.", user.id)
return
user_domain = email_parts[1].strip().lower()

View File

@@ -1027,8 +1027,7 @@ class LoginTest(SiteMixin, CacheIsolationTestCase, OpenEdxEventsTestMixin):
with self.assertLogs(level='WARN') as log:
_check_user_auth_flow(site, invalid_email_user)
assert len(log.output) == 1
assert "Shortcircuiting THIRD_PART_AUTH_ONLY_DOMAIN check." in log.output[0]
assert any("Shortcircuiting THIRD_PARTY_AUTH_ONLY_DOMAIN check." in warning for warning in log.output)
@ddt.ddt