-
-
Notifications
You must be signed in to change notification settings - Fork 448
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
refactor phone method availability checks #666
refactor phone method availability checks #666
Conversation
4e3748d
to
261e8ce
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #666 +/- ##
=======================================
Coverage 97.83% 97.84%
=======================================
Files 78 78
Lines 3378 3384 +6
Branches 376 384 +8
=======================================
+ Hits 3305 3311 +6
Misses 42 42
Partials 31 31 ☔ View full report in Codecov by Sentry. |
e210f44
to
7954670
Compare
Would it be possible to move the TWO_FACTOR_SMS/CALL_GATEWAY settings to base test settings in a separate commit/PR? |
4983f63
to
20dfb4f
Compare
@claudep ok, dropped that part. |
# This allows for dynamic registration, typically when testing. | ||
from .method import PhoneCallMethod, SMSMethod | ||
|
||
if getattr(settings, 'TWO_FACTOR_CALL_GATEWAY', None): | ||
installed_apps = getattr(settings, 'INSTALLED_APPS') or [] | ||
phone_number_app_installed = 'two_factor.plugins.phonenumber' in installed_apps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method of checking apps presence is brittle (as people may use custom app config which will be named differently). Do you think possible using apps.is_installed()
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, done!
20dfb4f
to
5cecf66
Compare
5cecf66
to
ae795df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good!
Fixes #663, fixes #665.
Description
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: