Skip to content

Conversation

@hiranya911
Copy link
Contributor

In #320 we removed the ability to delete user attributes by passing None to auth.update_user(). This change inadvertently affected the auth.set_custom_user_claims() method which should support deleting claims via passing None. This caused an integration test failure:

_______________________________________________________________________________ test_update_custom_user_claims _______________________________________________________________________________ new_user = <firebase_admin._user_mgt.UserRecord object at 0x7f876c0e1d10> def test_update_custom_user_claims(new_user): assert new_user.custom_claims is None claims = {'admin' : True, 'package' : 'gold'} auth.set_custom_user_claims(new_user.uid, claims) user = auth.get_user(new_user.uid) assert user.custom_claims == claims claims = {'admin' : False, 'subscription' : 'guest'} auth.set_custom_user_claims(new_user.uid, claims) user = auth.get_user(new_user.uid) assert user.custom_claims == claims auth.set_custom_user_claims(new_user.uid, None) user = auth.get_user(new_user.uid) > assert user.custom_claims is None E AssertionError: assert {'admin': False, 'subscription': 'guest'} is None E + where {'admin': False, 'subscription': 'guest'} = <firebase_admin._user_mgt.UserRecord object at 0x7f876c01b590>.custom_claims ../integration/test_auth.py:308: AssertionError 

This PR fixes the set_custom_user_claims() method, which now supports removing claims via both None and DELETE_ATTRIBUTE. I also updated the update_user() integration test to use DELETE_ATTRIBUTE instead of None.

Copy link
Member

@lahirumaramba lahirumaramba left a comment

Choose a reason for hiding this comment

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

LGTM!

@hiranya911 hiranya911 merged commit 88cd33f into master Sep 11, 2019
@hiranya911 hiranya911 deleted the hkj-delete-attr branch September 11, 2019 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants