Added 1 more test
Reason for this is "small" commit is becuase I will rebase my branch
@@ -923,19 +923,27 @@ class TestDispatchingEventAdapterImpl:
self, adapter_impl, gateway_impl, dispatch_impl, fabric_impl
):
fabric_impl.state_registry.get_guild_by_id = mock.MagicMock(return_value=None)
- payload = {"guild_id": "123", "role": {"id": "123"}}
-
+ payload = {"guild_id": "123", "role": {"id": "12"}}
await adapter_impl.handle_guild_role_update(gateway_impl, payload)
dispatch_impl.assert_called_once()
dispatch_impl.assert_called_with(events.RAW_GUILD_ROLE_UPDATE, payload)
@pytest.mark.asyncio
- @pytest.mark.skip(reason="Not implemented")
async def test_handle_guild_role_update_when_guild_is_cached_but_role_is_not_cached_does_not_dispatch_anything(
- self, adapter_impl, gateway_impl, dispatch_impl
+ self, adapter_impl, gateway_impl, dispatch_impl, fabric_impl
):
- ...
+ guild_obj = _helpers.mock_model(guilds.Guild, id="123", roles={})
+ fabric_impl.state_registry.get_guild_by_id = mock.MagicMock(
+ return_value=guild_obj)
+ fabric_impl.state_registry.update_role = mock.MagicMock(return_value=None)
+ payload = {"guild_id": str(guild_obj.id), "role": {"id": "12"}}
+
+ await adapter_impl.handle_guild_role_update(gateway_impl, payload)
+
+ dispatch_impl.assert_called_once()
+ dispatch_impl.assert_called_with(events.RAW_GUILD_ROLE_UPDATE, payload)
+
@pytest.mark.asyncio
@pytest.mark.skip(reason="Not implemented")
