Skip to content
This repository was archived by the owner on Jan 28, 2022. It is now read-only.

Commit f5a5d62

Browse files
author
Sergio García Prado
committed
ISSUE #?
* Minor improvements.
1 parent a26f05f commit f5a5d62

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

minos/networks/brokers/messages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Command(DeclarativeModel):
2929

3030
topic: str
3131
data: Any
32-
saga: UUID
32+
saga: Optional[UUID]
3333
reply_topic: str
3434
user: Optional[UUID]
3535

@@ -39,7 +39,7 @@ class CommandReply(DeclarativeModel):
3939

4040
topic: str
4141
data: Any
42-
saga: UUID
42+
saga: Optional[UUID]
4343
status: CommandStatus
4444
service_name: Optional[str]
4545

tests/test_networks/test_scheduling/test_schedulers.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import warnings
44
from unittest.mock import (
55
AsyncMock,
6+
MagicMock,
67
call,
78
patch,
89
)
@@ -87,15 +88,15 @@ def test_fn(self) -> None:
8788

8889
async def test_start(self) -> None:
8990
self.assertFalse(self.periodic.started)
91+
run_mock = MagicMock()
92+
self.periodic.run_forever = run_mock
9093

91-
with patch("asyncio.create_task", return_value="test") as mock_create:
92-
with warnings.catch_warnings():
93-
warnings.simplefilter("ignore", RuntimeWarning)
94-
await self.periodic.start()
95-
self.assertEqual(1, mock_create.call_count)
96-
self.assertEqual("run_forever", mock_create.call_args.args[0].__name__)
97-
self.assertTrue(self.periodic.started)
98-
self.assertEqual("test", self.periodic.task)
94+
with patch("asyncio.create_task", return_value="test"):
95+
await self.periodic.start()
96+
97+
self.assertTrue(self.periodic.started)
98+
self.assertEqual("test", self.periodic.task)
99+
self.assertEqual(1, run_mock.call_count)
99100

100101
async def test_stop(self) -> None:
101102
mock = AsyncMock()

0 commit comments

Comments
 (0)