Tests for member done
@@ -1062,33 +1062,33 @@ class TestStateRegistryImpl:
assert new is original_guild_obj, "existing guild was not used as target for update!"
assert old is cloned_guild_obj, "existing guild did not get the old state copied and returned!"
- @pytest.mark.skip(reason="WIP")
def test_update_member_when_guild_does_not_exist_returns_None(
self, registry: state_registry_impl.StateRegistryImpl
):
+ guild_obj = _helpers.mock_model(guilds.Guild, id=456, channels={}, roles={}, members={})
+ registry._guilds = {}
registry.get_member_by_id = mock.MagicMock(return_value=None, spec_set=registry.get_member_by_id)
- diff = registry.update_member("1234", [], None, registry.get_member_by_id)
+ diff = registry.update_member(
+ guild_obj.id, guild_obj.roles, None, registry.get_member_by_id)
assert diff is None
- @pytest.mark.skip(reason="WIP")
def test_update_member_when_existing_member_does_not_exist_returns_None(
self, registry: state_registry_impl.StateRegistryImpl
):
- guild_obj = _helpers.mock_model(guilds.Guild, id=124, channels={}, roles={}, members={})
+ guild_obj = _helpers.mock_model(guilds.Guild, id=456, channels={}, roles={}, members={})
registry._guilds = {guild_obj.id: guild_obj}
- member_obj = _helpers.mock_model(members.Member, id=1234)
+ registry.get_member_by_id = mock.MagicMock(return_value=None, spec_set=registry.get_member_by_id)
- diff = registry.update_member(guild_obj.id, guild_obj.roles, None, member_obj.id)
+ diff = registry.update_member(guild_obj .id, guild_obj.roles, None, registry.get_member_by_id)
assert diff is None
- @pytest.mark.skip(reason="WIP")
def test_update_member_when_existing_member_exists_returns_old_state_copy_and_updated_new_state(
self, registry: state_registry_impl.StateRegistryImpl
):
- guild_obj = _helpers.mock_model(guilds.Guild, id=124)
+ guild_obj = _helpers.mock_model(guilds.Guild, id=456, channels={}, roles={}, members={})
registry._guilds = {guild_obj.id: guild_obj}
original_member_obj = _helpers.mock_model(members.Member, id=123)
cloned_member_obj = _helpers.mock_model(members.Member, id=123)
