Update praw to 6.4.0 (#27324)

* Update praw to 6.4.0

* Update requirements_test_all.txt

* Fix docstrings

* Update tests
This commit is contained in:
Fabian Affolter
2019-10-27 10:04:43 +01:00
committed by GitHub
parent 2747f08385
commit 7e862e4d92
5 changed files with 11 additions and 12 deletions
+7 -5
View File
@@ -3,6 +3,7 @@ import copy
import unittest
from unittest.mock import patch
from homeassistant.components.reddit import sensor as reddit_sensor
from homeassistant.components.reddit.sensor import (
DOMAIN,
ATTR_SUBREDDIT,
@@ -98,7 +99,7 @@ MOCK_RESULTS_LENGTH = len(MOCK_RESULTS["results"])
class MockPraw:
"""Mock class for tmdbsimple library."""
"""Mock class for Reddit library."""
def __init__(
self,
@@ -112,7 +113,7 @@ class MockPraw:
self._data = MOCK_RESULTS
def subreddit(self, subreddit: str):
"""Return an instance of a sunbreddit."""
"""Return an instance of a subreddit."""
return MockSubreddit(subreddit, self._data)
@@ -160,8 +161,9 @@ class TestRedditSetup(unittest.TestCase):
@MockDependency("praw")
@patch("praw.Reddit", new=MockPraw)
def test_setup_with_valid_config(self, mock_praw):
"""Test the platform setup with movie configuration."""
setup_component(self.hass, "sensor", VALID_CONFIG)
"""Test the platform setup with Reddit configuration."""
with patch.object(reddit_sensor, "praw", mock_praw):
setup_component(self.hass, "sensor", VALID_CONFIG)
state = self.hass.states.get("sensor.reddit_worldnews")
assert int(state.state) == MOCK_RESULTS_LENGTH
@@ -186,6 +188,6 @@ class TestRedditSetup(unittest.TestCase):
@MockDependency("praw")
@patch("praw.Reddit", new=MockPraw)
def test_setup_with_invalid_config(self, mock_praw):
"""Test the platform setup with invalid movie configuration."""
"""Test the platform setup with invalid Reddit configuration."""
setup_component(self.hass, "sensor", INVALID_SORT_BY_CONFIG)
assert not self.hass.states.get("sensor.reddit_worldnews")