-
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
1 parent
ad8936e
commit 79ccbdc
Showing
6 changed files
with
35 additions
and
20 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,4 @@ | ||
{ | ||
"type": "FeatureCollection", | ||
"features": [] | ||
} |
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,22 +1,29 @@ | ||
from datetime import datetime, timedelta | ||
|
||
import h3 | ||
import pytest | ||
from .fixtures import * | ||
|
||
@pytest.mark.parametrize("cell_id", [ | ||
("89283082813ffff"), | ||
("8928308280fffff"), | ||
("89283082807ffff"), | ||
]) | ||
def test_can_publish_cell_brightness(cell_id, publisher, mock_pika_channel): | ||
publisher.publish_cell_brightness_message(cell_id) | ||
@pytest.mark.parametrize("cell_id", [x for x in h3.get_res0_indexes()]) | ||
def test_can_publish_cell_brightness_at_h3_indexes(cell_id, cell_publisher, mock_pika_channel): | ||
cell_publisher.publish_cell_brightness_message(cell_id) | ||
mock_pika_channel.basic_publish.assert_called_once() | ||
|
||
@pytest.mark.parametrize("minutes_ago", [ | ||
(i) for i in range(1, 10) | ||
]) | ||
def test_can_publish_cycle_complete(minutes_ago, publisher, mock_pika_channel): | ||
@pytest.mark.parametrize("minutes_ago", [i for i in range(1, 10)]) | ||
def test_can_publish_cycle_complete(minutes_ago, cell_publisher, mock_pika_channel): | ||
then = datetime.now() - timedelta(minutes=minutes_ago) | ||
now = datetime.now() | ||
publisher.publish_cycle_completion_message(then, now) | ||
cell_publisher.publish_cycle_completion_message(then, now) | ||
mock_pika_channel.basic_publish.assert_called_once() | ||
|
||
def test_publisher_raises_on_empty_cells(mock_grpc_client, mock_pika_channel): | ||
with pytest.raises(ValueError): | ||
cell_publisher = CellPublisher( | ||
api_host="localhost", | ||
api_port=50051, | ||
channel=mock_pika_channel, | ||
prediction_queue="prediction", | ||
cycle_queue="cycle", | ||
path_to_geojson=Path(__file__).parent / "empty.geojson" | ||
) | ||
cell_publisher.run() |