-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added integration test with live test server
- Loading branch information
Showing
2 changed files
with
28 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,31 @@ | ||
from unittest import TestCase | ||
|
||
from osbot_utils.utils.Dev import pprint | ||
from osbot_utils.utils.Http import is_port_open | ||
|
||
from osbot_fast_api.api.Fast_API import Fast_API | ||
from osbot_fast_api.utils.Fast_API_Server import Fast_API_Server | ||
from osbot_fast_api.utils.Version import Version | ||
|
||
|
||
class test_integration__Fast_API(TestCase): | ||
def setUp(self): | ||
self.fast_api = Fast_API() | ||
fast_api : Fast_API | ||
fast_api_server : Fast_API_Server | ||
|
||
def test_app(self): | ||
pprint('here') | ||
@classmethod | ||
def setUpClass(cls) -> None: | ||
cls.fast_api = Fast_API() | ||
cls.fast_api_server = Fast_API_Server(app=cls.fast_api.app()) | ||
cls.fast_api_server.start() | ||
assert cls.fast_api_server.is_port_open() is True | ||
|
||
@classmethod | ||
def tearDownClass(cls) -> None: | ||
cls.fast_api_server.stop() | ||
assert cls.fast_api_server.is_port_open() is False | ||
|
||
|
||
def test_version(self): | ||
response = self.fast_api_server.requests_get('/status/version') | ||
assert response.status_code == 200 | ||
assert response.json() == {'version': Version().value() } |