31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
import base64
|
|
import unittest
|
|
|
|
import httpx
|
|
from loguru import logger
|
|
|
|
|
|
class PydanticModelTestCase(unittest.TestCase):
|
|
|
|
def test_nakama_login(self):
|
|
nakama_endpoint = 'http://43.143.58.201:7350'
|
|
email = "ybj.yege@gmail.com"
|
|
password = "Bowong7777"
|
|
basic_auth_str = base64.b64encode(f"{email}:{password}".encode('utf8')).decode('utf8')
|
|
logger.info(basic_auth_str)
|
|
with httpx.Client() as client:
|
|
login_response = client.post(url=f"{nakama_endpoint}/v2/account/authenticate/email?create=false",
|
|
headers={
|
|
"Authorization": f"Basic {basic_auth_str}",
|
|
},
|
|
json={"email": "ybj.yege@gmail.com", "password": "Bowong7777"}
|
|
)
|
|
login_response.raise_for_status()
|
|
session_json = login_response.json()
|
|
logger.info(f"Login response: {session_json}")
|
|
self.assertEqual(True, True)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|