1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
""" test auth control flow """
import aiounittest
import datetime
import unittest
from unittest.mock import MagicMock, AsyncMock
from mypermobil import MyPermobil, MyPermobilClientException, MyPermobilAPIException
# pylint: disable=missing-docstring
class TestAuth(aiounittest.AsyncTestCase):
def setUp(self):
self.api = MyPermobil(
"test",
AsyncMock(),
region="http://example.com",
)
def test_str(self):
x = str(self.api)
assert x
async def test_close_session(self):
await self.api.close_session()
assert self.api.session is None
with self.assertRaises(MyPermobilClientException):
await self.api.close_session()
if __name__ == "__main__":
unittest.main()
|