-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add server testing utilities that are usable by third parties (#1784)
- Loading branch information
1 parent
69fe342
commit 32935da
Showing
7 changed files
with
49 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
""" | ||
Test utilities for :py:module:`betty.serve`. | ||
""" | ||
|
||
from typing import Any | ||
|
||
from typing_extensions import override | ||
|
||
from betty.locale.localizer import DEFAULT_LOCALIZER | ||
from betty.serve import Server, ProjectServer | ||
|
||
|
||
class NoOpServer(Server): | ||
""" | ||
A server that does nothing. | ||
""" | ||
|
||
def __init__(self, *_: Any, **__: Any): | ||
Server.__init__(self, DEFAULT_LOCALIZER) | ||
|
||
@override | ||
@property | ||
def public_url(self) -> str: | ||
return "https://example.com" | ||
|
||
@override | ||
async def start(self) -> None: | ||
pass | ||
|
||
@override | ||
async def stop(self) -> None: | ||
pass | ||
|
||
@override | ||
async def show(self) -> None: | ||
pass | ||
|
||
|
||
class NoOpProjectServer(NoOpServer, ProjectServer): | ||
""" | ||
A project server that does nothing. | ||
""" | ||
|
||
pass |
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
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