931fce82392af6834539017f3c9c62065eb44f5a,tests/components/media_player/test_soundtouch.py,TestSoundtouchMediaPlayer,test_create_zone,#TestSoundtouchMediaPlayer#Any#Any#Any#Any#,563

Before Change


        self.assertEqual(mocked_create_zone.call_count, 1)

        // unknown master. create zone is must not be called
        service = MockService("entity_X", [])
        soundtouch.create_zone_service(service)
        self.assertEqual(mocked_create_zone.call_count, 1)

        // no slaves, create zone must not be called

After Change


        soundtouch.setup_platform(self.hass,
                                  default_component(),
                                  mock.MagicMock())
        all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
        all_devices[0].entity_id = "media_player.entity_1"
        all_devices[1].entity_id = "media_player.entity_2"
        self.assertEqual(mocked_sountouch_device.call_count, 2)
        self.assertEqual(mocked_status.call_count, 2)
        self.assertEqual(mocked_volume.call_count, 2)

        // one master, one slave => create zone
        self.hass.services.call(soundtouch.DOMAIN,
                                soundtouch.SERVICE_CREATE_ZONE,
                                {"master": "media_player.entity_1",
                                 "slaves": ["media_player.entity_2"]}, True)
        self.assertEqual(mocked_create_zone.call_count, 1)

        // unknown master. create zone is must not be called
        self.hass.services.call(soundtouch.DOMAIN,
                                soundtouch.SERVICE_CREATE_ZONE,
                                {"master": "media_player.entity_X",
                                 "slaves": ["media_player.entity_2"]}, True)
        self.assertEqual(mocked_create_zone.call_count, 1)

        // no slaves, create zone must not be called
        self.hass.services.call(soundtouch.DOMAIN,
                                soundtouch.SERVICE_CREATE_ZONE,
                                {"master": "media_player.entity_X",
                                 "slaves": []}, True)
        self.assertEqual(mocked_create_zone.call_count, 1)

    @mock.patch("libsoundtouch.device.SoundTouchDevice.remove_zone_slave")
    @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 26

Instances


Project Name: home-assistant/home-assistant
Commit Name: 931fce82392af6834539017f3c9c62065eb44f5a
Time: 2017-04-19
Author: charles.blonde@gmail.com
File Name: tests/components/media_player/test_soundtouch.py
Class Name: TestSoundtouchMediaPlayer
Method Name: test_create_zone


Project Name: home-assistant/home-assistant
Commit Name: 931fce82392af6834539017f3c9c62065eb44f5a
Time: 2017-04-19
Author: charles.blonde@gmail.com
File Name: tests/components/media_player/test_soundtouch.py
Class Name: TestSoundtouchMediaPlayer
Method Name: test_add_zone_slave


Project Name: home-assistant/home-assistant
Commit Name: 931fce82392af6834539017f3c9c62065eb44f5a
Time: 2017-04-19
Author: charles.blonde@gmail.com
File Name: tests/components/media_player/test_soundtouch.py
Class Name: TestSoundtouchMediaPlayer
Method Name: test_play_everywhere