-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test for unknown messages sent to the recoder
- Loading branch information
Showing
1 changed file
with
17 additions
and
0 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 |
---|---|---|
|
@@ -49,6 +49,13 @@ def del_message(tmp_data_filename): | |
'"polarization": "hh", "sensor": "sar-c", "format": "GeoTIFF", "pass_direction": "ASCENDING"}') | ||
|
||
|
||
@pytest.fixture() | ||
def unknown_message(tmp_data_filename): | ||
"""Create a string for an unknown message.""" | ||
return ("pytroll://deletion some_unknown_key [email protected] 2019-11-05T13:00:10.366023 v1.01 " | ||
"application/json {}") | ||
|
||
|
||
@pytest.fixture() | ||
def tmp_data_filename(tmp_path): | ||
"""Create a filename for the messages.""" | ||
|
@@ -119,3 +126,13 @@ async def test_record_dataset_messages(tmp_path, dataset_message): | |
with patched_subscriber_recv([dataset_message]): | ||
await record_messages(config) | ||
assert await message_in_database_and_delete_count_is_one(msg) | ||
|
||
|
||
async def test_unknown_messages(check_log, tmp_path, unknown_message): | ||
"""Tests that we identify the message as being unknown, and we log that.""" | ||
config = AppConfig(**make_test_app_config_as_dict(tmp_path)) | ||
with running_prepared_database_context(): | ||
with patched_subscriber_recv([unknown_message]): | ||
await record_messages(config) | ||
|
||
assert check_log("DEBUG", "Don't know what to do with some_unknown_key message") |