mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-29 21:03:40 +00:00
20 lines
744 B
Python
20 lines
744 B
Python
import unittest
|
|
from unittest.mock import Mock, patch
|
|
|
|
|
|
class TestReauthentication(unittest.TestCase):
|
|
@patch("your_module.connection") # Replace 'your_module' with the actual module name
|
|
def test_reauthentication_flow(self, mock_connection):
|
|
mock_connection.reauthenticate = Mock(return_value=True)
|
|
result = mock_connection.reauthenticate()
|
|
self.assertTrue(result)
|
|
|
|
@patch("your_module.connection") # Replace 'your_module' with the actual module name
|
|
def test_connection_timeout(self, mock_connection):
|
|
mock_connection.connect = Mock(side_effect=TimeoutError)
|
|
with self.assertRaises(TimeoutError):
|
|
mock_connection.connect()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|