added packing and bundling test
This commit is contained in:
parent
1d70fb628e
commit
8afd87e44f
22
test/unit_tests/rest/utils.py
Normal file
22
test/unit_tests/rest/utils.py
Normal file
@ -0,0 +1,22 @@
|
||||
from funcy import compose, lzip
|
||||
|
||||
from pyinfra.server.packer.packers.identity import bundle
|
||||
from pyinfra.server.rest import unpack, pack
|
||||
from pyinfra.utils.func import lstarlift
|
||||
from test.utils.server import bytes_to_string
|
||||
|
||||
|
||||
def test_pack(input_data_items, metadata):
|
||||
assert lstarlift(pack)(zip(input_data_items, metadata)) == [
|
||||
{"data": bytes_to_string(d), "metadata": md} for d, md in zip(input_data_items, metadata)
|
||||
]
|
||||
|
||||
|
||||
def test_pack_unpack(input_data_items, metadata):
|
||||
assert lstarlift(compose(unpack, pack))(zip(input_data_items, metadata)) == lzip(input_data_items, metadata)
|
||||
|
||||
|
||||
def test_bundle(input_data_items, metadata):
|
||||
assert lstarlift(bundle)(zip(input_data_items, metadata)) == [
|
||||
{"data": d, "metadata": md} for d, md in zip(input_data_items, metadata)
|
||||
]
|
||||
Loading…
x
Reference in New Issue
Block a user