コード例 #1
0
ファイル: test_sleepiq.py プロジェクト: sara0871/master.zip
    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)
コード例 #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)
コード例 #3
0
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)
コード例 #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
コード例 #5
0
ファイル: test_sleepiq.py プロジェクト: sara0871/master.zip
    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)
コード例 #6
0
ファイル: test_init.py プロジェクト: ManHammer/home-assistant
    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)
コード例 #7
0
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
コード例 #8
0
ファイル: test_sleepiq.py プロジェクト: loraxx753/skynet
    def test_setup(self, mock):
        """Test the setup."""
        mock_responses(mock)

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

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