Skip to content

fix(base): really refresh object #1213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gitlab/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def _create_managers(self):

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."""
Expand Down
7 changes: 7 additions & 0 deletions gitlab/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ def test_update_attrs(self, fake_manager):
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"),)
Expand Down