moto/tests/test_core/test_socket.py

44 lines
1.1 KiB
Python
Raw Normal View History

2019-07-02 18:21:19 -07:00
import unittest
from moto import mock_dynamodb2_deprecated, mock_dynamodb2
import socket
class TestSocketPair(unittest.TestCase):
@mock_dynamodb2_deprecated
def test_asyncio_deprecated(self):
2021-07-26 07:40:39 +01:00
self.assertIn(
"httpretty.core.fakesock.socket",
str(socket.socket),
"Our mock should be present",
)
import asyncio
2019-10-31 08:44:26 -07:00
2021-07-26 07:40:39 +01:00
self.assertIsNotNone(asyncio.get_event_loop())
2019-07-02 18:21:19 -07:00
# Has boto3 equivalent
2019-07-02 18:21:19 -07:00
@mock_dynamodb2_deprecated
def test_socket_pair_deprecated(self):
2021-07-26 07:40:39 +01:00
self.assertIn(
"httpretty.core.fakesock.socket",
str(socket.socket),
"Our mock should be present",
)
2019-07-02 18:21:19 -07:00
a, b = socket.socketpair()
self.assertIsNotNone(a)
self.assertIsNotNone(b)
if a:
a.close()
if b:
b.close()
@mock_dynamodb2
def test_socket_pair(self):
a, b = socket.socketpair()
self.assertIsNotNone(a)
self.assertIsNotNone(b)
if a:
a.close()
if b:
b.close()