Beginning setup of new release testing.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
This commit is contained in:
33
release_tests/support/test_translate.py
Normal file
33
release_tests/support/test_translate.py
Normal file
@@ -0,0 +1,33 @@
|
||||
"""Confirms translate moxcking is working."""
|
||||
|
||||
from unittest import IsolatedAsyncioTestCase
|
||||
from uuid import uuid4
|
||||
from aiohttp import ClientSession
|
||||
from release_tests.support import ADDR
|
||||
from release_tests.support.translate import Translate
|
||||
|
||||
|
||||
class TranslateTC(IsolatedAsyncioTestCase):
|
||||
"""Confirms the translate mocking is working."""
|
||||
|
||||
async def test_create_translater_server(self):
|
||||
"""something"""
|
||||
trans = Translate()
|
||||
await trans.start()
|
||||
async with ClientSession() as session:
|
||||
async with session.get(f"http://{ADDR}:{trans.port}/") as resp:
|
||||
text = await resp.text()
|
||||
self.assertEqual(resp.status, 200, text)
|
||||
|
||||
async def test_url_reponses(self):
|
||||
"""created url reponse the mocks"""
|
||||
url = f"/{uuid4()}"
|
||||
replies = [str(uuid4()), str(uuid4())]
|
||||
trans = Translate(url=url, replies=replies)
|
||||
await trans.start()
|
||||
async with ClientSession() as session:
|
||||
for reply in replies:
|
||||
async with session.get(f"http://{ADDR}:{trans.port}{url}") as resp:
|
||||
text = await resp.text()
|
||||
self.assertEqual(resp.status, 200, text)
|
||||
self.assertEqual(text, reply)
|
||||
Reference in New Issue
Block a user