Fix test for same dicts
This commit is contained in:
parent
f621440116
commit
bd769f9e3f
1 changed files with 12 additions and 3 deletions
|
@ -615,13 +615,22 @@ class NextcloudHandler:
|
|||
else:
|
||||
self.exit.status_code_error(r.status_code)
|
||||
|
||||
def is_same_key(self, key, dict1, dict2):
|
||||
'''Test if two dictionaries have the same key with the same value'''
|
||||
if key in dict1 and key in dict2:
|
||||
if dict1[key] == dict2[key]:
|
||||
return True
|
||||
return False
|
||||
|
||||
def is_same_password(self, obj1, obj2):
|
||||
'''Test if two password objects are the same or similar'''
|
||||
if obj1 == obj2:
|
||||
return True
|
||||
if (obj1['username'] == obj2['username'] and
|
||||
obj1['password'] == obj2['password'] and
|
||||
obj1['url'] == obj2['url']):
|
||||
if (
|
||||
self.is_same_key('username', obj1, obj2) and
|
||||
self.is_same_key('password', obj1, obj2) and
|
||||
self.is_same_key('url', obj1, obj2)
|
||||
):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
Loading…
Reference in a new issue