-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from CCRI-POPROX/karl/refactor/repository-regi…
…stration Auto-register `DatabaseRepository` sub-classes to create with decorator
- Loading branch information
Showing
2 changed files
with
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from poprox_storage.repositories import DbArticleRepository | ||
from poprox_storage.repositories.data_stores.db import inject_repos | ||
from poprox_storage.repositories.newsletters import DbNewsletterRepository | ||
|
||
|
||
@inject_repos | ||
def example(event, context, article: DbArticleRepository, newsletter_repo: DbNewsletterRepository): | ||
return article, newsletter_repo | ||
|
||
|
||
def test_repositories(): | ||
retval = example({}, {}) | ||
assert isinstance(retval, tuple) | ||
assert len(retval) == 2 | ||
assert isinstance(retval[0], DbArticleRepository) | ||
assert isinstance(retval[1], DbNewsletterRepository) |