-
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.
- Loading branch information
G L
committed
Jul 28, 2024
1 parent
38025d7
commit d6b5728
Showing
8 changed files
with
50 additions
and
22 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
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,4 +1,4 @@ | ||
DELIVERY_SYSTEM="PostmarkDigestDeliverySystem" | ||
APP_EMAIL_ADDRESS=echopages@pachovit.com | ||
NUMBER_OF_UNITS_PER_DIGEST=1 | ||
DAILY_TIME_OF_DIGEST="12:45" | ||
DAILY_TIME_OF_DIGEST="13:45" |
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,18 +1,40 @@ | ||
from typing import List | ||
|
||
from echopages.domain import model | ||
from echopages.infrastructure.delivery import samplers | ||
|
||
|
||
def test_simple_content_sampler() -> None: | ||
samplers.CountIndex.value = 0 | ||
def test_simple_content_sampler_no_digests() -> None: | ||
contents = [ | ||
model.Content(id=0, text="content unit 1"), | ||
model.Content(id=1, text="content unit 2"), | ||
model.Content(id=2, text="content unit 3"), | ||
] | ||
digests: List[model.Digest] = [] | ||
|
||
content_sampler = samplers.SimpleContentSampler() | ||
sampled_contents = content_sampler.sample(contents, 8) | ||
sampled_contents = content_sampler.sample(digests, contents, 8) | ||
|
||
assert len(sampled_contents) == 8 | ||
for n in range(8): | ||
assert sampled_contents[n].id == (n % 3) | ||
|
||
|
||
def test_simple_content_sampler_previous_digests() -> None: | ||
content_ids = [1, 3, 5] | ||
contents = [ | ||
model.Content(id=1, text="content unit 1"), | ||
model.Content(id=3, text="content unit 3"), | ||
model.Content(id=5, text="content unit 5"), | ||
] | ||
digests = [ | ||
model.Digest(id=0, content_ids=[5]), | ||
model.Digest(id=1, content_ids=[1, 3]), | ||
] | ||
|
||
content_sampler = samplers.SimpleContentSampler() | ||
sampled_contents = content_sampler.sample(digests, contents, 8) | ||
|
||
assert len(sampled_contents) == 8 | ||
for n in range(8): | ||
assert sampled_contents[n].id == content_ids[(n + 2) % 3] |
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