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

refactor phone method availability checks #666

Conversation

jpaniagualaconich
Copy link
Contributor

@jpaniagualaconich jpaniagualaconich commented Sep 10, 2023

Fixes #663, fixes #665.

Description

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@jpaniagualaconich jpaniagualaconich force-pushed the bugfix/refactor-phone-method-availability-checks branch 3 times, most recently from 4e3748d to 261e8ce Compare September 10, 2023 20:54
@codecov
Copy link

codecov bot commented Sep 10, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (13a0f80) 97.83% compared to head (ae795df) 97.84%.

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.
📢 Have feedback on the report? Share it here.

@jpaniagualaconich jpaniagualaconich force-pushed the bugfix/refactor-phone-method-availability-checks branch 4 times, most recently from e210f44 to 7954670 Compare September 10, 2023 21:32
@jpaniagualaconich jpaniagualaconich marked this pull request as ready for review September 10, 2023 21:33
@claudep
Copy link
Contributor

claudep commented Sep 11, 2023

Would it be possible to move the TWO_FACTOR_SMS/CALL_GATEWAY settings to base test settings in a separate commit/PR?

@jpaniagualaconich jpaniagualaconich force-pushed the bugfix/refactor-phone-method-availability-checks branch 2 times, most recently from 4983f63 to 20dfb4f Compare September 11, 2023 08:41
@jpaniagualaconich
Copy link
Contributor Author

@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
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, done!

@jpaniagualaconich jpaniagualaconich force-pushed the bugfix/refactor-phone-method-availability-checks branch from 20dfb4f to 5cecf66 Compare February 3, 2024 18:17
@claudep claudep force-pushed the bugfix/refactor-phone-method-availability-checks branch from 5cecf66 to ae795df Compare February 3, 2024 18:50
Copy link
Contributor

@claudep claudep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good!

@claudep claudep merged commit 2ae4ce7 into jazzband:master Feb 3, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants