4dda842b16646b9f3863366a279d4dc65f262ece,tests/components/light/test_hue.py,TestSetup,test_update_lights_no_groups,#TestSetup#Any#,170

Before Change



        with patch("homeassistant.components.light.hue.process_lights",
                   return_value=self.mock_lights) as mock_process_lights:
            with patch("homeassistant.components.light.hue.process_groups",
                       return_value=self.mock_groups) \
                    as mock_process_groups:
                hue_light.unthrottled_update_lights(
                    self.hass, self.mock_bridge, self.mock_add_devices)

                mock_process_lights.assert_called_once_with(
                    self.hass, self.mock_api, self.mock_bridge, mock.ANY)
                mock_process_groups.assert_called_once_with(
                    self.hass, self.mock_api, self.mock_bridge, mock.ANY)
                self.mock_add_devices.assert_called_once_with(
                    self.mock_lights)

    @MockDependency("phue")
    def test_update_lights_with_lights_and_groups(self, mock_phue):
        Test the update_lights function with both lights and groups.
        self.setup_mocks_for_update_lights()

After Change


            self.build_mock_light(self.mock_bridge, 84, "light"),
        ]

        with patch(HUE_LIGHT_NS + "process_lights",
                   return_value=mock_lights) as mock_process_lights:
            with patch(HUE_LIGHT_NS + "process_groups", return_value=[]) \
                    as mock_process_groups:
                with patch.object(self.hass.helpers.dispatcher,
                                  "dispatcher_send") as dispatcher_send:
                    hue_light.unthrottled_update_lights(
                        self.hass, self.mock_bridge, self.mock_add_devices)

                    mock_process_lights.assert_called_once_with(
                        self.hass, self.mock_api, self.mock_bridge, mock.ANY)
                    mock_process_groups.assert_called_once_with(
                        self.hass, self.mock_api, self.mock_bridge, mock.ANY)
                    self.mock_add_devices.assert_called_once_with(
                        mock_lights)
                    dispatcher_send.assert_not_called()

    @MockDependency("phue")
    def test_update_lights_with_lights_and_groups(self, mock_phue):
        Test the update_lights function with both lights and groups.
        self.setup_mocks_for_update_lights()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 15

Instances


Project Name: home-assistant/home-assistant
Commit Name: 4dda842b16646b9f3863366a279d4dc65f262ece
Time: 2018-01-09
Author: andrea.campi@gmail.com
File Name: tests/components/light/test_hue.py
Class Name: TestSetup
Method Name: test_update_lights_no_groups


Project Name: home-assistant/home-assistant
Commit Name: 4dda842b16646b9f3863366a279d4dc65f262ece
Time: 2018-01-09
Author: andrea.campi@gmail.com
File Name: tests/components/light/test_hue.py
Class Name: TestSetup
Method Name: test_update_lights_with_some_lights


Project Name: home-assistant/home-assistant
Commit Name: 4dda842b16646b9f3863366a279d4dc65f262ece
Time: 2018-01-09
Author: andrea.campi@gmail.com
File Name: tests/components/light/test_hue.py
Class Name: TestSetup
Method Name: test_update_lights_no_groups


Project Name: home-assistant/home-assistant
Commit Name: 4dda842b16646b9f3863366a279d4dc65f262ece
Time: 2018-01-09
Author: andrea.campi@gmail.com
File Name: tests/components/light/test_hue.py
Class Name: TestSetup
Method Name: test_update_lights_with_no_lights