mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Clean artifacts after running Ring tests. (#6944)
* Clean artifacts after running Ring tests. * Clean artifacts from top level test_ring.py
This commit is contained in:
parent
534187f4cd
commit
a5f77d5f46
@ -1,4 +1,5 @@
|
|||||||
"""The tests for the Ring binary sensor platform."""
|
"""The tests for the Ring binary sensor platform."""
|
||||||
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
import requests_mock
|
import requests_mock
|
||||||
|
|
||||||
@ -6,7 +7,8 @@ from homeassistant.components.binary_sensor import ring
|
|||||||
from homeassistant.components import ring as base_ring
|
from homeassistant.components import ring as base_ring
|
||||||
|
|
||||||
from tests.components.test_ring import ATTRIBUTION, VALID_CONFIG
|
from tests.components.test_ring import ATTRIBUTION, VALID_CONFIG
|
||||||
from tests.common import get_test_home_assistant, load_fixture
|
from tests.common import (
|
||||||
|
get_test_config_dir, get_test_home_assistant, load_fixture)
|
||||||
|
|
||||||
|
|
||||||
class TestRingBinarySensorSetup(unittest.TestCase):
|
class TestRingBinarySensorSetup(unittest.TestCase):
|
||||||
@ -19,9 +21,15 @@ class TestRingBinarySensorSetup(unittest.TestCase):
|
|||||||
for device in devices:
|
for device in devices:
|
||||||
self.DEVICES.append(device)
|
self.DEVICES.append(device)
|
||||||
|
|
||||||
|
def cleanup(self):
|
||||||
|
"""Cleanup any data created from the tests."""
|
||||||
|
if os.path.isfile(self.cache):
|
||||||
|
os.remove(self.cache)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Initialize values for this testcase class."""
|
"""Initialize values for this testcase class."""
|
||||||
self.hass = get_test_home_assistant()
|
self.hass = get_test_home_assistant()
|
||||||
|
self.cache = get_test_config_dir(base_ring.DEFAULT_CACHEDB)
|
||||||
self.config = {
|
self.config = {
|
||||||
'username': 'foo',
|
'username': 'foo',
|
||||||
'password': 'bar',
|
'password': 'bar',
|
||||||
@ -31,6 +39,7 @@ class TestRingBinarySensorSetup(unittest.TestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""Stop everything that was started."""
|
"""Stop everything that was started."""
|
||||||
self.hass.stop()
|
self.hass.stop()
|
||||||
|
self.cleanup()
|
||||||
|
|
||||||
@requests_mock.Mocker()
|
@requests_mock.Mocker()
|
||||||
def test_binary_sensor(self, mock):
|
def test_binary_sensor(self, mock):
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
"""The tests for the Ring sensor platform."""
|
"""The tests for the Ring sensor platform."""
|
||||||
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
import requests_mock
|
import requests_mock
|
||||||
|
|
||||||
@ -6,7 +7,8 @@ from homeassistant.components.sensor import ring
|
|||||||
from homeassistant.components import ring as base_ring
|
from homeassistant.components import ring as base_ring
|
||||||
|
|
||||||
from tests.components.test_ring import ATTRIBUTION, VALID_CONFIG
|
from tests.components.test_ring import ATTRIBUTION, VALID_CONFIG
|
||||||
from tests.common import get_test_home_assistant, load_fixture
|
from tests.common import (
|
||||||
|
get_test_config_dir, get_test_home_assistant, load_fixture)
|
||||||
|
|
||||||
|
|
||||||
class TestRingSensorSetup(unittest.TestCase):
|
class TestRingSensorSetup(unittest.TestCase):
|
||||||
@ -19,9 +21,15 @@ class TestRingSensorSetup(unittest.TestCase):
|
|||||||
for device in devices:
|
for device in devices:
|
||||||
self.DEVICES.append(device)
|
self.DEVICES.append(device)
|
||||||
|
|
||||||
|
def cleanup(self):
|
||||||
|
"""Cleanup any data created from the tests."""
|
||||||
|
if os.path.isfile(self.cache):
|
||||||
|
os.remove(self.cache)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Initialize values for this testcase class."""
|
"""Initialize values for this testcase class."""
|
||||||
self.hass = get_test_home_assistant()
|
self.hass = get_test_home_assistant()
|
||||||
|
self.cache = get_test_config_dir(base_ring.DEFAULT_CACHEDB)
|
||||||
self.config = {
|
self.config = {
|
||||||
'username': 'foo',
|
'username': 'foo',
|
||||||
'password': 'bar',
|
'password': 'bar',
|
||||||
@ -36,6 +44,7 @@ class TestRingSensorSetup(unittest.TestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""Stop everything that was started."""
|
"""Stop everything that was started."""
|
||||||
self.hass.stop()
|
self.hass.stop()
|
||||||
|
self.cleanup()
|
||||||
|
|
||||||
@requests_mock.Mocker()
|
@requests_mock.Mocker()
|
||||||
def test_sensor(self, mock):
|
def test_sensor(self, mock):
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
"""The tests for the Ring component."""
|
"""The tests for the Ring component."""
|
||||||
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
import requests_mock
|
import requests_mock
|
||||||
|
|
||||||
from homeassistant import setup
|
from homeassistant import setup
|
||||||
import homeassistant.components.ring as ring
|
import homeassistant.components.ring as ring
|
||||||
|
|
||||||
from tests.common import get_test_home_assistant, load_fixture
|
from tests.common import (
|
||||||
|
get_test_config_dir, get_test_home_assistant, load_fixture)
|
||||||
|
|
||||||
ATTRIBUTION = 'Data provided by Ring.com'
|
ATTRIBUTION = 'Data provided by Ring.com'
|
||||||
|
|
||||||
@ -20,14 +22,21 @@ VALID_CONFIG = {
|
|||||||
class TestRing(unittest.TestCase):
|
class TestRing(unittest.TestCase):
|
||||||
"""Tests the Ring component."""
|
"""Tests the Ring component."""
|
||||||
|
|
||||||
|
def cleanup(self):
|
||||||
|
"""Cleanup any data created from the tests."""
|
||||||
|
if os.path.isfile(self.cache):
|
||||||
|
os.remove(self.cache)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Initialize values for this test case class."""
|
"""Initialize values for this test case class."""
|
||||||
self.hass = get_test_home_assistant()
|
self.hass = get_test_home_assistant()
|
||||||
|
self.cache = get_test_config_dir(ring.DEFAULT_CACHEDB)
|
||||||
self.config = VALID_CONFIG
|
self.config = VALID_CONFIG
|
||||||
|
|
||||||
def tearDown(self): # pylint: disable=invalid-name
|
def tearDown(self): # pylint: disable=invalid-name
|
||||||
"""Stop everything that was started."""
|
"""Stop everything that was started."""
|
||||||
self.hass.stop()
|
self.hass.stop()
|
||||||
|
self.cleanup()
|
||||||
|
|
||||||
@requests_mock.Mocker()
|
@requests_mock.Mocker()
|
||||||
def test_setup(self, mock):
|
def test_setup(self, mock):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user