diff options
-rw-r--r-- | gitlab/base.py | 2 | ||||
-rw-r--r-- | gitlab/tests/test_base.py | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gitlab/base.py b/gitlab/base.py index 40bc06c..ad35339 100644 --- a/gitlab/base.py +++ b/gitlab/base.py @@ -131,7 +131,7 @@ class RESTObject(object): def _update_attrs(self, new_attrs): self.__dict__["_updated_attrs"] = {} - self.__dict__["_attrs"].update(new_attrs) + self.__dict__["_attrs"] = new_attrs def get_id(self): """Returns the id of the resource.""" diff --git a/gitlab/tests/test_base.py b/gitlab/tests/test_base.py index 58c0d47..a0adcb0 100644 --- a/gitlab/tests/test_base.py +++ b/gitlab/tests/test_base.py @@ -128,6 +128,13 @@ class TestRESTObject: assert {"foo": "foo", "bar": "bar"} == obj._attrs assert {} == obj._updated_attrs + def test_update_attrs_deleted(self, fake_manager): + obj = FakeObject(fake_manager, {"foo": "foo", "bar": "bar"}) + obj.bar = "baz" + obj._update_attrs({"foo": "foo"}) + assert {"foo": "foo"} == obj._attrs + assert {} == obj._updated_attrs + def test_create_managers(self, fake_gitlab, fake_manager): class ObjectWithManager(FakeObject): _managers = (("fakes", "FakeManager"),) |