mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-28 00:24:33 +02:00
Aux console for Docker
Fix https://github.com/GNS3/gns3-gui/issues/1039
This commit is contained in:
4 files changed
+122
-32
No files matched your search
+13
-1
@@ -16,7 +16,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import asyncio
|
||||
from unittest.mock import patch
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
|
||||
class _asyncio_patch:
|
||||
@@ -62,3 +62,15 @@ class _asyncio_patch:
|
||||
|
||||
def asyncio_patch(function, *args, **kwargs):
|
||||
return _asyncio_patch(function, *args, **kwargs)
|
||||
|
||||
|
||||
class AsyncioMagicMock(MagicMock):
|
||||
"""
|
||||
Magic mock returning coroutine
|
||||
"""
|
||||
def __init__(self, return_value=None, **kwargs):
|
||||
if return_value:
|
||||
future = asyncio.Future()
|
||||
future.set_result(return_value)
|
||||
kwargs["return_value"] = future
|
||||
super().__init__(**kwargs)
|
||||
Reference in new issue
Block a user