-
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 #11 from davidjnevin/use_case_get_all_functionality
Use case get all functionality
- Loading branch information
Showing
3 changed files
with
38 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,34 @@ | ||
from chatcleaner.configurator.containers import Container | ||
|
||
|
||
def test_clean_use_case_add(get_fake_container, get_clean_use_case): | ||
def test_clean_use_case_clean(get_fake_container, get_clean_use_case): | ||
with Container.cleaning_uow.override(get_fake_container.cleaning_uow): | ||
with Container.chat_service.override(get_fake_container.chat_service): | ||
get_clean_use_case.add("\n19:10:00 from David to Everyone:\ntest") | ||
get_clean_use_case.clean("\n19:10:00 from David to Everyone:\ntest") | ||
uow_ = get_fake_container.cleaning_uow() | ||
with uow_: | ||
result = uow_.cleaning.get_all() | ||
assert len(result) == 1 | ||
assert result[0].chat == "\n19:10:00 from David to Everyone:\ntest" | ||
assert result[0].cleaned_chat == "test" | ||
|
||
|
||
def test_clean_use_case_get_all(get_fake_container, get_clean_use_case): | ||
with Container.cleaning_uow.override(get_fake_container.cleaning_uow): | ||
with Container.chat_service.override(get_fake_container.chat_service): | ||
get_clean_use_case.clean("\n19:10:00 from David to Everyone:\ntest 1") | ||
get_clean_use_case.clean("\n19:10:00 from David to Everyone:\ntest 2") | ||
get_clean_use_case.clean("\n19:10:00 from David to Everyone:\ntest 3") | ||
uow_ = get_fake_container.cleaning_uow() | ||
with uow_: | ||
result = get_clean_use_case.get_all() | ||
# fixtures are scopes to module, so this should be 4 | ||
assert len(result) == 4 | ||
assert result[0].chat == "\n19:10:00 from David to Everyone:\ntest" | ||
assert result[0].cleaned_chat == "test" | ||
assert result[1].chat == "\n19:10:00 from David to Everyone:\ntest 1" | ||
assert result[1].cleaned_chat == "test 1" | ||
assert result[2].chat == "\n19:10:00 from David to Everyone:\ntest 2" | ||
assert result[2].cleaned_chat == "test 2" | ||
assert result[3].chat == "\n19:10:00 from David to Everyone:\ntest 3" | ||
assert result[3].cleaned_chat == "test 3" |