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/mock.py

50 lines
982 B
Python
Raw Normal View History

2023-01-13 15:23:27 +03:00
from requests_mock import Mocker
from tests import files
mock = Mocker()
with mock:
mock.get(
2023-05-24 16:41:33 +03:00
f'{BASE_URL}/go/',
2023-01-13 15:23:27 +03:00
content=files.read_html('aternos_go'),
)
mock.get(
2023-05-24 16:41:33 +03:00
f'{BASE_URL}/servers/',
2023-01-13 15:23:27 +03:00
content=files.read_html('aternos_servers'),
)
mock.get(
2023-05-24 16:41:33 +03:00
f'{BASE_URL}/server/',
2023-01-13 15:23:27 +03:00
content=files.read_html('aternos_server1'),
)
mock.get(
2023-05-24 16:41:33 +03:00
f'{AJAX_URL}/status.php',
2023-01-13 15:23:27 +03:00
content=files.read_html('aternos_status'),
)
mock.post(
2023-05-24 16:41:33 +03:00
f'{AJAX_URL}/account/login.php',
2023-01-13 15:23:27 +03:00
json={
'success': True,
'error': None,
'message': None,
'show2FA': False,
},
cookies={
'ATERNOS_SESSION': '0123abcd',
},
)
mock.get(
2023-05-24 16:41:33 +03:00
f'{BASE_URL}/players/',
2023-01-13 15:23:27 +03:00
content=files.read_html('aternos_players'),
)
mock.get(
2023-05-24 16:41:33 +03:00
f'{BASE_URL}/files/',
2023-01-13 15:23:27 +03:00
content=files.read_html('aternos_file_root'),
)