Fix unit test error

1. What is the problem
Unit tests fail due to miss function of update_fields.

2. What is the solution for the problem
Add update_fields function.

3. What features need to be implemented to the Tricircle to
realize the solution
N/A

Change-Id: I41bff60b4c4cffb1eddde9e2733c4ebaa9ad948c
This commit is contained in:
chenyaguang 2017-12-22 23:30:59 -08:00
parent 815d1ff008
commit 827d9b5b75
1 changed files with 8 additions and 0 deletions

View File

@ -107,6 +107,9 @@ class DotDict(dict):
return dummy_value_map[item]
return self.get(item)
def __setattr__(self, name, value):
self[name] = value
def to_dict(self):
return self
@ -119,6 +122,11 @@ class DotDict(dict):
def save(self, session=None):
pass
def update_fields(self, obj_data):
for k, v in obj_data.items():
if k in self:
setattr(self, k, v)
class DotList(list):
def all(self):