This repository has been archived on 2024-07-30. You can view files and clone it, but cannot push or open issues or pull requests.
python-aternos/tests/test_http.py

41 lines
923 B
Python
Raw Normal View History

2023-01-13 16:23:27 +04:00
#!/usr/bin/env python3
import unittest
from python_aternos import Client
from tests import mock
class TestHttp(unittest.TestCase):
2023-01-13 16:23:27 +04:00
def test_basic(self) -> None:
with mock.mock:
Client().login('test', '')
2023-01-13 16:23:27 +04:00
# no exception = ok
2023-01-13 16:23:27 +04:00
def test_servers(self) -> None:
with mock.mock:
at = Client()
at.login('test', '')
srvs = at.account.list_servers(cache=False)
2023-01-13 16:23:27 +04:00
self.assertTrue(srvs)
2023-01-13 16:23:27 +04:00
def test_status(self) -> None:
with mock.mock:
at = Client()
at.login('test', '')
srv = at.account.list_servers(cache=False)[0]
srv.fetch()
2023-01-13 16:23:27 +04:00
self.assertEqual(
srv.subdomain,
'world35v',
)
self.assertEqual(
srv.is_java,
True,
)
if __name__ == '__main__':
unittest.main()