コード例 #1
0
ファイル: test_profobuf.py プロジェクト: 2Fake/devolo_plc_api
    async def test__async_wrong_password_type(self, httpx_mock: HTTPXMock,
                                              mock_device: Device):
        """Test using different password hash if original password failed."""
        await mock_device.async_connect()
        assert mock_device.device
        mock_device.password = "******"

        httpx_mock.add_response(status_code=HTTPStatus.UNAUTHORIZED)
        with pytest.raises(DevicePasswordProtected):
            await mock_device.device.async_get_wifi_connected_station()
            assert mock_device.device.password == "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"

        httpx_mock.add_response(status_code=HTTPStatus.UNAUTHORIZED)
        with pytest.raises(DevicePasswordProtected):
            await mock_device.device.async_get_wifi_connected_station()
            assert mock_device.device.password == "113459eb7bb31bddee85ade5230d6ad5d8b2fb52879e00a84ff6ae1067a210d3"

        await mock_device.async_disconnect()
コード例 #2
0
 def test_set_password(self, mock_device: Device, device_api: DeviceApi):
     """Test setting a device password is also reflected in the device API."""
     mock_device.device = device_api
     mock_device.password = "******"
     assert mock_device.device.password == "super_secret"