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

feat: replace username with extrainfo national_id #222

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

andrey-canon
Copy link
Collaborator

Description

This replaces the username references with the extrainfo national id field

Testing instructions

Before

After

Additional information

Include anything else that will help reviewers and consumers understand the change.

  • Does this change depend on other changes elsewhere?
  • Any special concerns or limitations? For example: deprecations, migrations, security, or accessibility.
  • Link to other information about the change, such as Jira issues, GitHub issues, or Discourse discussions.

Checklist for Merge

  • Tested in a remote environment
  • Updated documentation
  • Rebased master/main
  • Squashed commits

@@ -114,6 +114,7 @@ def tearDown(self): # pylint: disable=invalid-name
self.transformer_class.get_data.reset_mock()
self.transformer_class.get_data.side_effect = None
self.transformer_class.get_object_iri.reset_mock()
modulestore.reset_mock()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is affecting other tests since assertion depends on clean mocks

@andrey-canon andrey-canon force-pushed the and/update_national_id_references branch 2 times, most recently from f4bbe6a to f2f58bc Compare October 9, 2024 19:42
@andrey-canon andrey-canon force-pushed the and/update_national_id_references branch from f2f58bc to 6d169c5 Compare October 9, 2024 19:44
@@ -14,7 +14,7 @@
from ddt import data, ddt
from django.conf import settings
from django.contrib.auth import get_user_model
from django.test import override_settings
from django.test import TestCase, override_settings
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why you need to use Django test case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Becasue unittest.TestCase doesn't work with reverse relations, so things like user.extrainfo fails

@@ -355,9 +355,12 @@ def mt_course_passed_handler(user, course_id, **kwargs): # pylint: disable=unus
if not getattr(settings, "ACTIVATE_MT_TRAINING_STAGE", False):
return

extra_info = getattr(user, "extrainfo", None)
national_id = extra_info.national_id if extra_info else user.username
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about if national_id is "". that would be sent?. Is weird to found same usernames. But this this field of extra_info seems allow blank

@andrey-canon andrey-canon merged commit 17ab6ed into master Oct 9, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants