コード例 #1
0
ファイル: test_sensor.py プロジェクト: dadaloop82/core
    def test_setup_sigle(self, mock):
        """Test for successfully setting up the SleepIQ platform."""
        mock_responses(mock, single=True)

        assert setup_component(self.hass, "sleepiq", {"sleepiq": self.config})

        sleepiq.setup_platform(self.hass, self.config, self.add_entities, MagicMock())
        assert 1 == len(self.DEVICES)

        right_side = self.DEVICES[0]
        assert "SleepNumber ILE Test1 SleepNumber" == right_side.name
        assert 40 == right_side.state
コード例 #2
0
async def test_setup_sigle(hass, requests_mock):
    """Test for successfully setting up the SleepIQ platform."""
    mock_responses(requests_mock, single=True)

    assert await async_setup_component(hass, "sleepiq", {"sleepiq": CONFIG})

    device_mock = MagicMock()
    sleepiq.setup_platform(hass, CONFIG, device_mock, MagicMock())
    devices = device_mock.call_args[0][0]
    assert len(devices) == 1

    right_side = devices[0]
    assert right_side.name == "SleepNumber ILE Test1 SleepNumber"
    assert right_side.state == 40
コード例 #3
0
    def test_setup(self, mock):
        """Test for successfully setting up the SleepIQ platform."""
        mock_responses(mock)

        assert setup_component(self.hass, 'sleepiq', {'sleepiq': self.config})

        sleepiq.setup_platform(self.hass, self.config, self.add_entities,
                               MagicMock())
        assert 2 == len(self.DEVICES)

        left_side = self.DEVICES[1]
        assert 'SleepNumber ILE Test1 SleepNumber' == left_side.name
        assert 40 == left_side.state

        right_side = self.DEVICES[0]
        assert 'SleepNumber ILE Test2 SleepNumber' == right_side.name
        assert 80 == right_side.state
コード例 #4
0
async def test_setup(hass, requests_mock):
    """Test for successfully setting up the SleepIQ platform."""
    mock_responses(requests_mock)

    assert await async_setup_component(hass, "sleepiq", {"sleepiq": CONFIG})

    device_mock = MagicMock()
    sleepiq.setup_platform(hass, CONFIG, device_mock, MagicMock())
    devices = device_mock.call_args[0][0]
    assert 2 == len(devices)

    left_side = devices[1]
    assert "SleepNumber ILE Test1 SleepNumber" == left_side.name
    assert 40 == left_side.state

    right_side = devices[0]
    assert "SleepNumber ILE Test2 SleepNumber" == right_side.name
    assert 80 == right_side.state
コード例 #5
0
    def test_setup(self, mock):
        """Test for successfully setting up the SleepIQ platform."""
        mock_responses(mock)

        assert setup_component(self.hass, 'sleepiq', {
            'sleepiq': {
                'username': '',
                'password': '',
            }
        })

        sleepiq.setup_platform(self.hass,
                               self.config,
                               self.add_entities,
                               MagicMock())
        assert 2 == len(self.DEVICES)

        left_side = self.DEVICES[1]
        assert 'SleepNumber ILE Test1 SleepNumber' == left_side.name
        assert 40 == left_side.state

        right_side = self.DEVICES[0]
        assert 'SleepNumber ILE Test2 SleepNumber' == right_side.name
        assert 80 == right_side.state