Skip to content

Commit

Permalink
Fix message publishing in move_it, update test
Browse files Browse the repository at this point in the history
  • Loading branch information
lahtinep committed Feb 19, 2024
1 parent 8113a2d commit e7e6894
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion trollmoves/move_it.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def publish_hook(pathname, dest_url, config, publisher):
"""Publish hook for move_it."""
dest = os.path.join(dest_url.path, os.path.basename(pathname))
msg = create_message_with_request_info(dest, pathname, config)
publisher.send(msg)
publisher.send(str(msg))


def process_notify(pathname, publisher, chain_config):
Expand Down
4 changes: 3 additions & 1 deletion trollmoves/tests/test_move_it.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def test_move_it_moves_files(tmp_path):

def test_move_it_published_a_message(tmp_path):
"""Test that move it is publishing messages when provided a port."""
from posttroll.message import Message

input_dir = tmp_path / "in"
output_dir = tmp_path / "out"
os.mkdir(input_dir)
Expand Down Expand Up @@ -79,7 +81,7 @@ def test_move_it_published_a_message(tmp_path):
move_it_thread.chains_stop()

assert len(message_list) == 1
message = message_list[0]
message = Message(rawstr=message_list[0])
assert message.type == "file"
assert message.data == {"sensors": "seviri", "stream": "eumetcast", "number": "1",
"uri": str(output_dir / "bla1.txt"), "uid": "bla1.txt"}

0 comments on commit e7e6894

Please sign in to comment.