-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f39b45
commit 7fc23ae
Showing
3 changed files
with
46 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from unittest.mock import AsyncMock, patch | ||
|
||
import pytest | ||
|
||
from faststream import FastStream | ||
from faststream.constants import AppState | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_state_running(app: FastStream): | ||
with patch( | ||
"faststream._internal.application.Application.start", new_callable=AsyncMock | ||
): | ||
await app._startup() | ||
assert app.state == AppState.STATE_RUNNING | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_state_stopped(app: FastStream): | ||
with ( | ||
patch( | ||
"faststream._internal.application.Application.start", new_callable=AsyncMock | ||
), | ||
patch( | ||
"faststream._internal.application.Application.stop", new_callable=AsyncMock | ||
), | ||
): | ||
await app._startup() | ||
await app._shutdown() | ||
assert app.state == AppState.STATE_STOPPED |