Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pypi th2 5249 lwdp download messages endpoint #110

Merged
merged 19 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,5 @@ BugFixes without ticket

## BugFixes
1. [TH2-5222] - Fix `DownloadMessagesByPageGzip`, it constructed `DownloadMessagesByPageByGroupsGzip` incorrectly.
2. [TH2-5243] - Fix backward compatibility issues with `GetMessagesByBookByGroups` and `GetMessagesByPageByGroups`.
2. [TH2-5243] - Fix backward compatibility issues with `GetMessagesByBookByGroups` and `GetMessagesByPageByGroups`,
added 'limit' and 'search_direction' parameters to 'post_download_messages'.
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ th2-data-services~=2.0.0.dev8779326749
# We don't need it now, because we don't suport grpc now
# th2_grpc_lw_data_provider==2.0.0.dev3656626108
orjson>=3.10,<4
aiohttp>=3.9.5,<4
aiohttp>=3.9.5,<4
nest-asyncio>=1.6.0,<2
19 changes: 19 additions & 0 deletions tests/tests_unit/tests_common/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
import pytest
from datetime import datetime

from th2_data_services.data_source.lwdp import Stream, Streams
from th2_data_services.data_source.lwdp.streams import _convert_stream_to_dict_format
from th2_data_services.data_source.lwdp.utils import _check_timestamp


def test_datetime_invalid_type():
with pytest.raises(Exception) as err:
_check_timestamp(datetime.now().timestamp())
assert "Provided timestamp should be `datetime`, `str` or `int` object in UTC time" in str(err)


def test_convert_stream_to_dict_format():
streams = [
"s1:1",
{"sessionAlias": "s2", "direction": ["IN"]},
Stream("s3", 2),
Streams(["s4"]),
]
expected = [
{"sessionAlias": "s1", "direction": ["IN"]},
{"sessionAlias": "s2", "direction": ["IN"]},
{"sessionAlias": "s3", "direction": ["OUT"]},
{"sessionAlias": "s4"},
]
assert _convert_stream_to_dict_format(streams) == expected
Loading
Loading