Browse Source

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
changes/11/529911/1
chenyaguang 3 years ago
parent
commit
827d9b5b75
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      tricircle/tests/unit/utils.py

+ 8
- 0
tricircle/tests/unit/utils.py 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):


Loading…
Cancel
Save