Skip to content

Commit

Permalink
Added docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
tisnik committed Nov 10, 2023
1 parent b289163 commit 342ca89
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/publishers/kafka_publisher_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
BEST_COMPRESSION = 9

def timeStampMasking(message):
"""Mask four bytes in Gzip stream that contain timestamp."""
message=list(message)
message[4] = 0
message[5] = 0
Expand All @@ -134,6 +135,7 @@ def test_init_compression():

@pytest.mark.parametrize("input", VALID_INPUT_MSG)
def test_compressing_enabled(input):
"""Check if message is gzipped if compression is enabled."""
input = bytes(json.dumps(input) + "\n",'utf-8')
expected_output = timeStampMasking(gzip.compress(input,compresslevel=BEST_COMPRESSION))
kakfa_config = {
Expand All @@ -149,6 +151,7 @@ def test_compressing_enabled(input):

@pytest.mark.parametrize("input", VALID_INPUT_MSG)
def test_compressing_disabled(input):
"""Check if message is not gzipped if compression is disabled."""
input = bytes(json.dumps(input) + "\n",'utf-8')
expected_output = input
kakfa_config = {
Expand Down

0 comments on commit 342ca89

Please sign in to comment.