1
mirror of https://github.com/home-assistant/core synced 2024-09-03 08:14:07 +02:00
ha-core/tests/test_test_fixtures.py
2021-10-05 14:46:09 -10:00

19 lines
498 B
Python

"""Test test fixture configuration."""
import socket
import pytest
import pytest_socket
def test_sockets_disabled():
"""Test we can't open sockets."""
with pytest.raises(pytest_socket.SocketBlockedError):
socket.socket()
def test_sockets_enabled(socket_enabled):
"""Test we can't connect to an address different from 127.0.0.1."""
mysocket = socket.socket()
with pytest.raises(pytest_socket.SocketConnectBlockedError):
mysocket.connect(("127.0.0.2", 1234))