Skip to content

Commit e1e0d8c

Browse files
committed
fix(base): really refresh object
This fixes and error, where deleted attributes would not show up Fixes #1155
1 parent 3a38c6d commit e1e0d8c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

gitlab/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def _create_managers(self):
131131

132132
def _update_attrs(self, new_attrs):
133133
self.__dict__["_updated_attrs"] = {}
134-
self.__dict__["_attrs"].update(new_attrs)
134+
self.__dict__["_attrs"] = new_attrs
135135

136136
def get_id(self):
137137
"""Returns the id of the resource."""

gitlab/tests/test_base.py

+7
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ def test_update_attrs(self, fake_manager):
128128
assert {"foo": "foo", "bar": "bar"} == obj._attrs
129129
assert {} == obj._updated_attrs
130130

131+
def test_update_attrs_deleted(self, fake_manager):
132+
obj = FakeObject(fake_manager, {"foo": "foo", "bar": "bar"})
133+
obj.bar = "baz"
134+
obj._update_attrs({"foo": "foo"})
135+
assert {"foo": "foo"} == obj._attrs
136+
assert {} == obj._updated_attrs
137+
131138
def test_create_managers(self, fake_gitlab, fake_manager):
132139
class ObjectWithManager(FakeObject):
133140
_managers = (("fakes", "FakeManager"),)

0 commit comments

Comments
 (0)