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

Enable updating nin #716

Merged
merged 13 commits into from
Nov 28, 2024
Merged

Enable updating nin #716

merged 13 commits into from
Nov 28, 2024

Conversation

helylle
Copy link
Contributor

@helylle helylle commented Nov 19, 2024

Enable updating NIN and locked NIN if the new NIN has a reference to the currently locked NIN
Use case is changing of national identity number or groinf from coordination number to national identoty number

Comment on lines +197 to +201
attributes = {
"$set": {
"identities": [{"identity_type": IdentityType.NIN.value, "number": "200102031234", "verified": True}]
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nins have previously been replaced

Comment on lines +224 to +226
"identities": [
{"identity_type": IdentityType.NIN.value, "number": locked_nin.number, "verified": True}
], # hubba-bubba
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nins have previously been replaced

Comment on lines 202 to 207
new_attributes = check_locked_identity(self.amdb, user_id, attributes, "test")

# check_locked_identity should create a locked_identity so add it to the expected attributes
locked_nin = NinIdentity(number="200102031234", created_by="test", is_verified=True)
locked_identities = LockedIdentityList(elements=[locked_nin])
attributes["$set"]["locked_identity"] = locked_identities.to_list_of_dicts()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

check_locked_attributes used to modify (and return) attributes, i.e. the same entity, so even if it did not add locked_identity the test was always true as attributes and new_attributes were the same dict

Comment on lines 229 to 231
new_attributes = check_locked_identity(self.amdb, user_id, attributes, "test")

locked_identities = LockedIdentityList(elements=[locked_nin])
attributes["$set"]["locked_identity"] = locked_identities.to_list_of_dicts()

# user has locked_identity that is the same as the verified identity so only identities should be set
self.assertDictEqual(attributes, new_attributes)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The same comment as for test above

@helylle helylle marked this pull request as ready for review November 28, 2024 11:06
Copy link

sonarcloud bot commented Nov 28, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
12.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@johanlundberg johanlundberg merged commit 4dfafcc into main Nov 28, 2024
10 of 11 checks passed
@johanlundberg johanlundberg deleted the ylle_reference_nin branch November 28, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants