Skip to content

Commit 49d82b5

Browse files
committed
moved http_shell code to the _to_refactor folder
1 parent 2ec276c commit 49d82b5

8 files changed

Lines changed: 20 additions & 19 deletions

File tree

osbot_fast_api/utils/http_shell/Http_Shell__Client.py renamed to _to_refactor_to_separate_project/code/http_shell/Http_Shell__Client.py

File renamed without changes.

osbot_fast_api/utils/http_shell/Http_Shell__Server.py renamed to _to_refactor_to_separate_project/code/http_shell/Http_Shell__Server.py

File renamed without changes.
File renamed without changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# code
2+
3+
def add_shell_server(self):
4+
from osbot_fast_api.utils.http_shell.Http_Shell__Server import Model__Shell_Command, Http_Shell__Server
5+
def shell_server(shell_command: Model__Shell_Command):
6+
return Http_Shell__Server().invoke(shell_command)
7+
self.add_route_post(shell_server)
8+
9+
# tests
10+
11+
def test_add_shell_server(self): # Test shell server route addition
12+
with Fast_API() as _:
13+
_.setup()
14+
initial_routes = len(_.routes_paths())
15+
16+
_.add_shell_server()
17+
18+
# Verify route was added
19+
assert len(_.routes_paths()) == initial_routes + 1
20+
assert '/shell-server' in _.routes_paths()

tests/unit/api/routes/http_shell/test_Http_Shell__Client.py renamed to _to_refactor_to_separate_project/tests/http_shell/test_Http_Shell__Client.py

File renamed without changes.

tests/unit/api/routes/http_shell/test_Http_Shell__Server.py renamed to _to_refactor_to_separate_project/tests/http_shell/test_Http_Shell__Server.py

File renamed without changes.

osbot_fast_api/api/Fast_API.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@ def add_flask_app(self, path, flask_app):
6969
self.app().mount(path, WSGIMiddleware(flask_app))
7070
return self
7171

72-
def add_shell_server(self):
73-
from osbot_fast_api.utils.http_shell.Http_Shell__Server import Model__Shell_Command, Http_Shell__Server
74-
def shell_server(shell_command: Model__Shell_Command):
75-
return Http_Shell__Server().invoke(shell_command)
76-
self.add_route_post(shell_server)
77-
7872
def add_route(self,function, methods):
7973
path = '/' + function.__name__.replace('_', '-')
8074
self.app().add_api_route(path=path, endpoint=function, methods=methods)

tests/unit/api/test_Fast_API.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -272,19 +272,6 @@ def test_validation_exception_handler(self): # Test
272272
assert response.status_code == 400
273273
assert b'"detail"' in response.body
274274

275-
# Shell server tests
276-
277-
def test_add_shell_server(self): # Test shell server route addition
278-
with Fast_API() as _:
279-
_.setup()
280-
initial_routes = len(_.routes_paths())
281-
282-
_.add_shell_server()
283-
284-
# Verify route was added
285-
assert len(_.routes_paths()) == initial_routes + 1
286-
assert '/shell-server' in _.routes_paths()
287-
288275
# Route management tests
289276

290277
def test_add_route_get(self): # Test GET route addition

0 commit comments

Comments
 (0)