Test tweaks (#11560)
* Fix is_allowed_path on OS X * Move APNS2 inside func in test
This commit is contained in:
1 parent
d793cfeb68
commit
0d06e8c1c9
2 files changed
+5
-2
No files matched your search
@@ -3,7 +3,6 @@ import io
|
||||
import unittest
|
||||
from unittest.mock import Mock, patch, mock_open
|
||||
|
||||
from apns2.errors import Unregistered
|
||||
import yaml
|
||||
|
||||
import homeassistant.components.notify as notify
|
||||
@@ -359,6 +358,8 @@ class TestApns(unittest.TestCase):
|
||||
@patch('homeassistant.components.notify.apns._write_device')
|
||||
def test_disable_when_unregistered(self, mock_write, mock_client):
|
||||
"""Test disabling a device when it is unregistered."""
|
||||
from apns2.errors import Unregistered
|
||||
|
||||
send = mock_client.return_value.send_notification
|
||||
send.side_effect = Unregistered()
|
||||
|
||||
|
||||
+3
-1
@@ -797,8 +797,10 @@ class TestConfig(unittest.TestCase):
|
||||
def test_is_allowed_path(self):
|
||||
"""Test is_allowed_path method."""
|
||||
with TemporaryDirectory() as tmp_dir:
|
||||
# The created dir is in /tmp. This is a symlink on OS X
|
||||
# causing this test to fail unless we resolve path first.
|
||||
self.config.whitelist_external_dirs = set((
|
||||
tmp_dir,
|
||||
os.path.realpath(tmp_dir),
|
||||
))
|
||||
|
||||
test_file = os.path.join(tmp_dir, "test.jpg")
|
||||
|
||||
Reference in new issue
Block a user