Skip to content

Commit

Permalink
Update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Limych committed Oct 1, 2023
1 parent 9339565 commit 864c48b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
1 change: 0 additions & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
-r requirements.txt
asynctest~=0.13
flake8~=6.1
flake8-docstrings~=1.7
mypy==1.0.0
Expand Down
11 changes: 6 additions & 5 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
"""
from http import HTTPStatus
from typing import Any, Optional
from unittest.mock import patch
from unittest.mock import Mock, patch

from aiohttp import ClientSession
from asynctest import CoroutineMock
from pytest import raises
from pytest_homeassistant_custom_component.common import load_fixture

Expand Down Expand Up @@ -79,10 +78,12 @@ def test__get():
@patch("aiohttp.ClientSession.get")
async def test__async_get_data(mock_get, caplog):
"""Test with valid location data."""

async def mock_coroutine():
return "qwe"

mock_get.return_value.__aenter__.return_value.status = HTTPStatus.OK
mock_get.return_value.__aenter__.return_value.text = CoroutineMock(
return_value="qwe"
)
mock_get.return_value.__aenter__.return_value.text = Mock(wraps=mock_coroutine)
#
caplog.clear()
async with ClientSession() as client:
Expand Down
3 changes: 1 addition & 2 deletions tests/test_entity.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Tests for GisMeteo integration."""

from asynctest import Mock
from unittest.mock import Mock

from custom_components.gismeteo import GismeteoDataUpdateCoordinator
from custom_components.gismeteo.const import (
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sensor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Tests for GisMeteo integration."""
from unittest.mock import Mock

from asynctest import Mock
from pytest_homeassistant_custom_component.common import assert_setup_component

from custom_components.gismeteo import GismeteoDataUpdateCoordinator
Expand Down
3 changes: 2 additions & 1 deletion tests/test_weather.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tests for GisMeteo integration."""
from asynctest import Mock
from unittest.mock import Mock

from pytest_homeassistant_custom_component.common import assert_setup_component

from custom_components.gismeteo import GismeteoDataUpdateCoordinator
Expand Down

0 comments on commit 864c48b

Please sign in to comment.