Replaced start up tests.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s

This commit is contained in:
2025-06-22 17:04:37 -04:00
parent e69dbf58fa
commit e555acfdb4
6 changed files with 121 additions and 16 deletions

View File

@@ -2,7 +2,7 @@
from unittest import IsolatedAsyncioTestCase
from aiohttp import ClientSession
from release_tests.support import ADDR
from release_tests.support import get_port
from release_tests.support.mttserver import MTTServer
@@ -13,9 +13,23 @@ class MTTServerTC(IsolatedAsyncioTestCase):
"""Test default start up."""
mtt = MTTServer()
await mtt.start()
url = f"http://{ADDR}:{mtt.port}"
url = mtt.baseurl
self.assertEqual(url, "http://127.0.0.1:3000")
async with ClientSession() as session:
async with session.get(url) as resp:
text = await resp.text()
self.assertEqual(resp.status, 200, text)
self.assertEqual(mtt.baseurl, url)
await mtt.cleanup()
async def test_flags(self):
"""Make sure flags are working."""
host = "127.28.56.13"
port = get_port()
mtt = MTTServer("-a", host, "-p", port)
self.assertEqual(mtt.baseurl, f"http://{host}:{port}")
await mtt.start()
async with ClientSession() as session:
async with session.get(mtt.baseurl) as resp:
text = await resp.text()
self.assertEqual(resp.status, 200, text)
await mtt.cleanup()