Beispiel #1
0
    def test_setup_login_failed(self, mock):
        """Test the setup if a bad username or password is given."""
        mock.put('https://api.sleepiq.sleepnumber.com/rest/login',
                 status_code=401,
                 json=load_fixture('sleepiq-login-failed.json'))

        response = sleepiq.setup(self.hass, self.config)
        self.assertFalse(response)
Beispiel #2
0
    def test_setup_login_failed(self, mock):
        """Test the setup if a bad username or password is given."""
        mock.put('https://api.sleepiq.sleepnumber.com/rest/login',
                 status_code=401,
                 json=load_fixture('sleepiq-login-failed.json'))

        response = sleepiq.setup(self.hass, self.config)
        self.assertFalse(response)
async def test_setup(hass, requests_mock):
    """Test the setup."""
    mock_responses(requests_mock)

    # We're mocking the load_platform discoveries or else the platforms
    # will be setup during tear down when blocking till done, but the mocks
    # are no longer active.
    with patch("homeassistant.helpers.discovery.load_platform", MagicMock()):
        assert sleepiq.setup(hass, CONFIG)
Beispiel #4
0
    def test_setup_login_failed(self, mock):
        """Test the setup if a bad username or password is given."""
        mock.put(
            "https://prod-api.sleepiq.sleepnumber.com/rest/login",
            status_code=401,
            json=load_fixture("sleepiq-login-failed.json"),
        )

        response = sleepiq.setup(self.hass, self.config)
        assert not response
Beispiel #5
0
    def test_setup(self, mock):
        """Test the setup."""
        mock_responses(mock)

        # We're mocking the load_platform discoveries or else the platforms
        # will be setup during tear down when blocking till done, but the mocks
        # are no longer active.
        with patch('homeassistant.helpers.discovery.load_platform',
                   MagicMock()):
            assert sleepiq.setup(self.hass, self.config)
Beispiel #6
0
    def test_setup(self, mock):
        """Test the setup."""
        mock_responses(mock)

        # We're mocking the load_platform discoveries or else the platforms
        # will be setup during tear down when blocking till done, but the mocks
        # are no longer active.
        with patch(
                'homeassistant.helpers.discovery.load_platform', MagicMock()):
            assert sleepiq.setup(self.hass, self.config)
async def test_setup_login_failed(hass, requests_mock):
    """Test the setup if a bad username or password is given."""
    mock_responses(requests_mock)
    requests_mock.put(
        "https://prod-api.sleepiq.sleepnumber.com/rest/login",
        status_code=HTTPStatus.UNAUTHORIZED,
        json=load_fixture("sleepiq-login-failed.json"),
    )

    response = sleepiq.setup(hass, CONFIG)
    assert not response
Beispiel #8
0
    def test_setup(self, mock):
        """Test the setup."""
        mock_responses(mock)

        response = sleepiq.setup(self.hass, self.config)
        self.assertTrue(response)
Beispiel #9
0
    def test_setup(self, mock):
        """Test the setup."""
        mock_responses(mock)

        response = sleepiq.setup(self.hass, self.config)
        self.assertTrue(response)