File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -63,5 +63,7 @@ def identity_hash(self):
63
63
identity_vars = getattr (self , 'identity_vars' , [])
64
64
parts = {}
65
65
for var in identity_vars :
66
- parts [var ] = getattr (self , var , None )
66
+ id_var = getattr (self , var , None )
67
+ if id_var : # only present id var if it is not blank or None
68
+ parts [var ] = id_var
67
69
return parts
Original file line number Diff line number Diff line change @@ -423,3 +423,24 @@ def it_can_call_increment_on_the_same_key_twice_and_increment_by_2(self): # noq
423
423
self .user .increment ('mad' )
424
424
self .user .increment ('mad' )
425
425
eq_ (self .user .to_dict ['custom_attributes' ]['mad' ], 125 )
426
+
427
+ @istest
428
+ def it_can_save_after_increment (self ): # noqa
429
+ user = User (
430
+ email = None , user_id = "i-1224242" ,
431
+ companies = [{'company_id' : 6 , 'name' : 'Intercom' }])
432
+ body = {
433
+ 'custom_attributes' : {},
434
+ 'email' : "" ,
435
+ 'user_id' : 'i-1224242' ,
436
+ 'companies' : [{
437
+ 'company_id' : 6 ,
438
+ 'name' : 'Intercom'
439
+ }]
440
+ }
441
+ with patch .object (Intercom , 'post' , return_value = body ) as mock_method : # noqa
442
+ user .increment ('mad' )
443
+ eq_ (user .to_dict ['custom_attributes' ]['mad' ], 1 )
444
+ user .save ()
445
+ ok_ ('email' not in user .identity_hash )
446
+ ok_ ('user_id' in user .identity_hash )
You can’t perform that action at this time.
0 commit comments