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: add extrainfo arabic to pipelines RTI #196

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions eox_nelp/pearson_vue/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ def get_user_data(user_id, **kwargs): # pylint: disable=unused-argument
phone_country_code = str(pn.country_code)
extrainfo = getattr(user, "extrainfo", None)
arabic_name = extrainfo.arabic_name if extrainfo else ""
arabic_first_name = extrainfo.arabic_first_name if extrainfo else ""
arabic_last_name = extrainfo.arabic_last_name if extrainfo else ""

return {
"profile_metadata": {
Expand All @@ -148,6 +150,8 @@ def get_user_data(user_id, **kwargs): # pylint: disable=unused-argument
"mobile_number": phone,
"mobile_country_code": phone_country_code,
"arabic_name": arabic_name,
"arabic_first_name": arabic_first_name,
"arabic_last_name": arabic_last_name,
},
}

Expand Down Expand Up @@ -375,8 +379,8 @@ def build_cdd_request(profile_metadata, **kwargs): # pylint: disable=unused-arg
"nativeAddress": {
"language": getattr(settings, "PEARSON_RTI_NATIVE_ADDRESS_LANGUAGE", "UKN"),
"potentialMismatch": "false",
"firstName": profile_metadata["arabic_name"],
"lastName": profile_metadata["arabic_name"],
"firstName": profile_metadata["arabic_first_name"],
"lastName": profile_metadata["arabic_last_name"],
"address1": profile_metadata["address"],
"city": profile_metadata["city"],
},
Expand Down
11 changes: 8 additions & 3 deletions eox_nelp/pearson_vue/tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
"nativeAddress": {
"address1": "123 Main St",
"city": "Anytown",
"firstName": "فلان الفلاني",
"firstName": "كلارك",
"language": "UKN",
"lastName": "فلان الفلاني",
"lastName": "كينت",
"potentialMismatch": "false",
},
"phone": {"phoneCountryCode": "1", "phoneNumber": "5551234567"},
Expand Down Expand Up @@ -252,6 +252,8 @@ def setUp(self):
)
self.extrainfo = MagicMock(
arabic_name="كلارك كينت",
arabic_first_name="كلارك",
arabic_last_name="كينت",
)
anonymous_id_for_user.return_value = "ABCDF1245678899"
setattr(User, "profile", self.profile)
Expand Down Expand Up @@ -290,6 +292,8 @@ def test_get_user_data(self, phone):
"mobile_number": phone_number,
"mobile_country_code": country_code,
"arabic_name": self.extrainfo.arabic_name,
"arabic_first_name": self.extrainfo.arabic_first_name,
"arabic_last_name": self.extrainfo.arabic_last_name,
},
}
result = get_user_data(self.user.id)
Expand Down Expand Up @@ -692,6 +696,8 @@ def setUp(self):
"mobile_number": "5551234567",
"mobile_country_code": "1",
"arabic_name": "فلان الفلاني",
"arabic_first_name": "كلارك",
"arabic_last_name": "كينت",
}
}

Expand All @@ -708,7 +714,6 @@ def test_cdd_request(self, mock_timezone):
}

result = build_cdd_request(**self.input_data)

self.assertDictEqual(expected_output, result)

@patch("eox_nelp.pearson_vue.pipeline.timezone")
Expand Down
Loading