-
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.
Connect lending and catalogue domains over Redis broker
The catalogue domain now publishes a message over channel "book_instance_added" which is consumed by the lending domain to initialize the local `Book` aggregate.
- Loading branch information
Showing
24 changed files
with
369 additions
and
81 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
test: | ||
pytest | ||
pytest tests/lending tests/catalogue | ||
|
||
test-cov: | ||
pytest --cov=src/lending --cov-report=term-missing --cov-branch | ||
pytest tests/lending tests/catalogue --cov=src/lending --cov=src/catalogue --cov-report=term-missing --cov-branch |
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
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
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
Empty file.
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,3 @@ | ||
from .book_instance_added import BookInstanceAdded | ||
|
||
__all__ = ["BookInstanceAdded"] |
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,12 @@ | ||
from protean import BaseEvent | ||
from protean.fields import Boolean, DateTime, Float, Identifier, String, Text | ||
|
||
|
||
class BookInstanceAdded(BaseEvent): | ||
instance_id = Identifier(required=True) | ||
isbn = String(required=True) | ||
title = String(required=True) | ||
summary = Text(required=True) | ||
price = Float(required=True) | ||
is_circulating = Boolean(required=True) | ||
added_at = DateTime(required=True) |
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,10 @@ | ||
from catalogue.main import get_db | ||
from sqlalchemy.orm import Session | ||
|
||
|
||
def test_get_db(): | ||
db = next(get_db()) | ||
assert db is not None | ||
assert isinstance(db, Session) | ||
assert db.bind is not None | ||
assert db.bind.url.database == "./books.db" |
Empty file.
9 changes: 9 additions & 0 deletions
9
tests/lending/bdd/additions/features/book_instanced_added.feature
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,9 @@ | ||
Feature: Check Out a Book | ||
|
||
Scenario: Book instance is added to catalogue | ||
Given the librarian added a CIRCULATING book instance | ||
Then a CIRCULATING book instance is successfully added as available | ||
|
||
Scenario: Restricted Book instance is added to catalogue | ||
Given the librarian added a RESTRICTED book instance | ||
Then a RESTRICTED book instance is successfully added as available |
Oops, something went wrong.