Refactor fibaro scene test
diff --git a/tests/components/fibaro/conftest.py b/tests/components/fibaro/conftest.py
index 2b6580c3191b..e15d6509a00c 100644
--- a/tests/components/fibaro/conftest.py
+++ b/tests/components/fibaro/conftest.py
@@ -2,16 +2,21 @@
 from collections.abc import Generator
 from unittest.mock import AsyncMock, Mock, patch
 
-from pyfibaro.fibaro_scene import SceneModel
 import pytest
 
-from homeassistant.components.fibaro import DOMAIN
-from homeassistant.config_entries import ConfigEntry
-from homeassistant.const import Platform
+from homeassistant.components.fibaro import CONF_IMPORT_PLUGINS, DOMAIN
+from homeassistant.const import CONF_PASSWORD, CONF_URL, CONF_USERNAME
 from homeassistant.core import HomeAssistant
 
 from tests.common import MockConfigEntry
 
+TEST_SERIALNUMBER = "HC2-111111"
+TEST_NAME = "my_fibaro_home_center"
+TEST_URL = "http://192.168.1.1/api/"
+TEST_USERNAME = "user"
+TEST_PASSWORD = "password"
+TEST_VERSION = "4.360"
+
 
 @pytest.fixture
 def mock_setup_entry() -> Generator[AsyncMock, None, None]:
@@ -22,10 +27,10 @@ def mock_setup_entry() -> Generator[AsyncMock, None, None]:
         yield mock_setup_entry
 
 
-@pytest.fixture(name="fibaro_scene")
-def mock_scene() -> SceneModel:
+@pytest.fixture
+def mock_scene() -> Mock:
     """Fixture for an individual scene."""
-    scene = Mock(SceneModel)
+    scene = Mock()
     scene.fibaro_id = 1
     scene.name = "Test scene"
     scene.room_id = 1
@@ -33,23 +38,57 @@ def mock_scene() -> SceneModel:
     return scene
 
 
-async def setup_platform(
-    hass: HomeAssistant,
-    platform: Platform,
-    room_name: str | None,
-    scenes: list[SceneModel],
-) -> ConfigEntry:
-    """Set up the fibaro platform and prerequisites."""
-    hass.config.components.add(DOMAIN)
-    config_entry = MockConfigEntry(domain=DOMAIN, title="Test")
-    config_entry.add_to_hass(hass)
-
-    controller_mock = Mock()
-    controller_mock.hub_serial = "HC2-111111"
-    controller_mock.get_room_name.return_value = room_name
-    controller_mock.read_scenes.return_value = scenes
-
-    hass.data[DOMAIN] = {config_entry.entry_id: controller_mock}
-    await hass.config_entries.async_forward_entry_setup(config_entry, platform)
+@pytest.fixture
+def mock_room() -> Mock:
+    """Fixture for an individual room."""
+    room = Mock()
+    room.fibaro_id = 1
+    room.name = "Room 1"
+    return room
+
+
+@pytest.fixture
+def mock_config_entry(hass: HomeAssistant) -> MockConfigEntry:
+    """Return the default mocked config entry."""
+    mock_config_entry = MockConfigEntry(
+        domain=DOMAIN,
+        data={
+            CONF_URL: TEST_URL,
+            CONF_USERNAME: TEST_USERNAME,
+            CONF_PASSWORD: TEST_PASSWORD,
+            CONF_IMPORT_PLUGINS: True,
+        },
+    )
+    mock_config_entry.add_to_hass(hass)
+    return mock_config_entry
+
+
+@pytest.fixture
+def mock_fibaro_client() -> Generator[Mock, None, None]:
+    """Return a mocked FibaroClient."""
+    info_mock = Mock()
+    info_mock.serial_number = TEST_SERIALNUMBER
+    info_mock.hc_name = TEST_NAME
+    info_mock.current_version = TEST_VERSION
+
+    with patch(
+        "homeassistant.components.fibaro.FibaroClient", autospec=True
+    ) as fibaro_client_mock:
+        client = fibaro_client_mock.return_value
+        client.set_authentication.return_value = None
+        client.connect.return_value = True
+        client.read_info.return_value = info_mock
+        client.read_rooms.return_value = []
+        client.read_scenes.return_value = []
+        client.read_devices.return_value = []
+        client.register_update_handler.return_value = None
+        client.unregister_update_handler.return_value = None
+        yield client
+
+
+async def init_integration(
+    hass: HomeAssistant, mock_config_entry: MockConfigEntry
+) -> None:
+    """Set up the fibaro integration for testing."""
+    assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
     await hass.async_block_till_done()
-    return config_entry
diff --git a/tests/components/fibaro/test_scene.py b/tests/components/fibaro/test_scene.py
index 09e0543976fd..0ce618e903c2 100644
--- a/tests/components/fibaro/test_scene.py
+++ b/tests/components/fibaro/test_scene.py
@@ -1,21 +1,30 @@
 """Test the Fibaro scene platform."""
-
-from pyfibaro.fibaro_scene import SceneModel
+from unittest.mock import Mock
 
 from homeassistant.components.scene import DOMAIN as SCENE_DOMAIN
-from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_ON, Platform
+from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_ON
 from homeassistant.core import HomeAssistant
 from homeassistant.helpers import entity_registry as er
 
-from .conftest import setup_platform
+from .conftest import init_integration
+
+from tests.common import MockConfigEntry
 
 
-async def test_entity_attributes(hass: HomeAssistant, fibaro_scene: SceneModel) -> None:
+async def test_entity_attributes(
+    hass: HomeAssistant,
+    mock_fibaro_client: Mock,
+    mock_config_entry: MockConfigEntry,
+    mock_scene: Mock,
+    mock_room: Mock,
+) -> None:
     """Test that the attributes of the entity are correct."""
     # Arrange
+    mock_fibaro_client.read_rooms.return_value = [mock_room]
+    mock_fibaro_client.read_scenes.return_value = [mock_scene]
     entity_registry = er.async_get(hass)
     # Act
-    await setup_platform(hass, Platform.SCENE, "Room 1", [fibaro_scene])
+    await init_integration(hass, mock_config_entry)
     # Assert
     entry = entity_registry.async_get("scene.room_1_test_scene")
 
@@ -25,13 +34,20 @@ async def test_entity_attributes(hass: HomeAssistant, fibaro_scene: SceneModel)
 
 
 async def test_entity_attributes_without_room(
-    hass: HomeAssistant, fibaro_scene: SceneModel
+    hass: HomeAssistant,
+    mock_fibaro_client: Mock,
+    mock_config_entry: MockConfigEntry,
+    mock_scene: Mock,
+    mock_room: Mock,
 ) -> None:
     """Test that the attributes of the entity are correct."""
     # Arrange
+    mock_room.name = None
+    mock_fibaro_client.read_rooms.return_value = [mock_room]
+    mock_fibaro_client.read_scenes.return_value = [mock_scene]
     entity_registry = er.async_get(hass)
     # Act
-    await setup_platform(hass, Platform.SCENE, None, [fibaro_scene])
+    await init_integration(hass, mock_config_entry)
     # Assert
     entry = entity_registry.async_get("scene.unknown_test_scene")
 
@@ -39,10 +55,19 @@ async def test_entity_attributes_without_room(
     assert entry.unique_id == "hc2_111111.scene.1"
 
 
-async def test_activate_scene(hass: HomeAssistant, fibaro_scene: SceneModel) -> None:
+async def test_activate_scene(
+    hass: HomeAssistant,
+    mock_fibaro_client: Mock,
+    mock_config_entry: MockConfigEntry,
+    mock_scene: Mock,
+    mock_room: Mock,
+) -> None:
     """Test activate scene is called."""
     # Arrange
-    await setup_platform(hass, Platform.SCENE, "Room 1", [fibaro_scene])
+    mock_fibaro_client.read_rooms.return_value = [mock_room]
+    mock_fibaro_client.read_scenes.return_value = [mock_scene]
+    # Act
+    await init_integration(hass, mock_config_entry)
     # Act
     await hass.services.async_call(
         SCENE_DOMAIN,
@@ -51,4 +76,4 @@ async def test_activate_scene(hass: HomeAssistant, fibaro_scene: SceneModel) ->
         blocking=True,
     )
     # Assert
-    assert fibaro_scene.start.call_count == 1
+    assert mock_scene.start.call_count == 1

<!--
  You are amazing! Thanks for contributing to our project!
  Please, DO NOT DELETE ANY TEXT from this template! (unless instructed).
-->


## Proposed change
<!--
  Describe the big picture of your changes here to communicate to the
  maintainers why we should accept this pull request. If it fixes a bug
  or resolves a feature request, be sure to link to that issue in the
  additional information section.
-->
Refactor scene test to properly init integration as suggested in late review.
https://github.com/home-assistant/core/pull/100547#discussion_r1329770102

With this change also other fibaro tests can reuse the mocks and it should be easy possible to add more tests.

If you are already interested on how this would affect the fibaro config flow test see this commit: https://github.com/home-assistant/core/commit/db154a764cc8ba0d1598654993fab59ea6a4c4ae

## Type of change
<!--
  What type of change does your PR introduce to Home Assistant?
  NOTE: Please, check only 1! box!
  If your PR requires multiple boxes to be checked, you'll most likely need to
  split it into multiple PRs. This makes things easier and faster to code review.
-->

- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [ ] New feature (which adds functionality to an existing integration)
- [ ] Deprecation (breaking change to happen in the future)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [X] Code quality improvements to existing code or addition of tests

## Additional information
<!--
  Details are important, and help maintainers processing your PR.
  Please be sure to fill out additional details, if applicable.
-->

- This PR fixes or closes issue: fixes #
- This PR is related to issue: 
- Link to documentation pull request: 

## Checklist
<!--
  Put an `x` in the boxes that apply. You can also fill these out after
  creating the PR. If you're unsure about any of them, don't hesitate to ask.
  We're here to help! This is simply a reminder of what we are going to look
  for before merging your code.
-->

- [X] The code change is tested and works locally.
- [X] Local tests pass. **Your PR cannot be merged unless tests pass**
- [X] There is no commented out code in this PR.
- [X] I have followed the [development checklist][dev-checklist]
- [X] I have followed the [perfect PR recommendations][perfect-pr]
- [X] The code has been formatted using Black (`black --fast homeassistant tests`)
- [ ] Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]

If the code communicates with devices, web services, or third-party tools:

- [ ] The [manifest file][manifest-docs] has all fields filled out correctly.  
      Updated and included derived files by running: `python3 -m script.hassfest`.
- [ ] New or updated dependencies have been added to `requirements_all.txt`.  
      Updated by running `python3 -m script.gen_requirements_all`.
- [ ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
- [ ] Untested files have been added to `.coveragerc`.

<!--
  This project is very active and we have a high turnover of pull requests.

  Unfortunately, the number of incoming pull requests is higher than what our
  reviewers can review and merge so there is a long backlog of pull requests
  waiting for review. You can help here!
  
  By reviewing another pull request, you will help raise the code quality of
  that pull request and the final review will be faster. This way the general
  pace of pull request reviews will go up and your wait time will go down.
  
  When picking a pull request to review, try to choose one that hasn't yet
  been reviewed.

  Thanks for helping out!
-->

To help with the load of incoming pull requests:

- [ ] I have reviewed two other [open pull requests][prs] in this repository.

[prs]: https://github.com/home-assistant/core/pulls?q=is%3Aopen+is%3Apr+-author%3A%40me+-draft%3Atrue+-label%3Awaiting-for-upstream+sort%3Acreated-desc+review%3Anone+-status%3Afailure

<!--
  Thank you for contributing <3

  Below, some useful links you could explore:
-->
[dev-checklist]: https://developers.home-assistant.io/docs/development_checklist/
[manifest-docs]: https://developers.home-assistant.io/docs/creating_integration_manifest/
[quality-scale]: https://developers.home-assistant.io/docs/integration_quality_scale_index/
[docs-repository]: https://github.com/home-assistant/home-assistant.io
[perfect-pr]: https://developers.home-assistant.io/docs/review-process/#creating-the-perfect-pr
