-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
1a7ba79
commit 957d367
Showing
13 changed files
with
148 additions
and
56 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
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,20 @@ | ||
"""This module manages state for the application.""" | ||
|
||
from typing import Dict | ||
|
||
from app.providers.provider_aws import ProviderAWS | ||
from app.providers.provider_base import ProviderBase | ||
|
||
|
||
class ENPState: | ||
"""Custom application state class.""" | ||
|
||
def __init__(self) -> None: | ||
"""Initialize ENPState with a default set of providers.""" | ||
# Route handlers should access this dictionary to send notifications using | ||
# various third-party services, such as AWS, Twilio, etc. | ||
self.providers: Dict[str, ProviderBase] = {'aws': ProviderAWS()} | ||
|
||
def clear_providers(self) -> None: | ||
"""Clear the providers dictionary.""" | ||
self.providers.clear() |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"""Test for ENPState Module.""" | ||
|
||
from app.providers.provider_aws import ProviderAWS | ||
from app.state import ENPState | ||
|
||
|
||
def test_enp_state_initialization() -> None: | ||
"""Test to make sure ENPState can have provider attribute.""" | ||
state = ENPState() | ||
assert isinstance(state.providers, dict) | ||
assert 'aws' in state.providers | ||
assert isinstance(state.providers['aws'], ProviderAWS) | ||
|
||
|
||
def test_clear_providers() -> None: | ||
"""Test the clear_providers method to ensure it clears the providers dictionary.""" | ||
state = ENPState() | ||
|
||
assert len(state.providers) == 1 | ||
state.clear_providers() | ||
assert len(state.providers) == 0 |
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
Oops, something went wrong.