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)
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
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)
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
def test_setup(self, mock): """Test the setup.""" mock_responses(mock) response = sleepiq.setup(self.hass, self.config) self.assertTrue(response)