|
1 | 1 | import pytest
|
2 |
| -from stp_core.common.util import adict |
| 2 | + |
3 | 3 | from stp_core.crypto.util import randomSeed
|
4 | 4 | from stp_core.loop.eventually import eventually
|
5 | 5 | from stp_core.network.port_dispenser import genHa
|
6 | 6 | from stp_core.test.helper import Printer, prepStacks, chkPrinted
|
7 | 7 | from stp_zmq.test.helper import genKeys, create_and_prep_stacks, \
|
8 | 8 | check_stacks_communicating, get_file_permission_mask, get_zstack_key_paths
|
9 | 9 | from stp_zmq.zstack import ZStack
|
| 10 | +from stp_core.common.util import adict |
10 | 11 |
|
11 | 12 |
|
12 | 13 | def testRestricted2ZStackCommunication(tdir, looper, tconf):
|
@@ -81,7 +82,7 @@ def test_zstack_non_utf8(tdir, looper, tconf):
|
81 | 82 | alpha.transmit(b'{"k2": "v2\x9c"}', uid, serialized=True)
|
82 | 83 | with pytest.raises(AssertionError):
|
83 | 84 | looper.run(eventually(chkPrinted, betaP, {"k2": "v2\x9c"}))
|
84 |
| - # TODO: A better test where the output of the parsing method is checked |
| 85 | + # TODO: A better test where the output of the parsing method is checked |
85 | 86 | # requires spyable methods
|
86 | 87 |
|
87 | 88 | # Again send a utf-8 message and see its received (checks if stack is
|
@@ -158,21 +159,13 @@ def create_stack(name, handler=None):
|
158 | 159 |
|
159 | 160 | assert len(received_messages) != 0
|
160 | 161 | assert len(expected_messages) == len(received_messages), \
|
161 |
| - "{} != {}, LAST IS {}".format(len(expected_messages), |
162 |
| - len(received_messages), |
163 |
| - received_messages[-1]) |
164 |
| - |
165 |
| - |
166 |
| -@pytest.fixture(scope="function") |
167 |
| -def patch_msg_len(tconf): |
168 |
| - old_value = tconf.MSG_LEN_LIMIT |
169 |
| - tconf.MSG_LEN_LIMIT = 128 * 1024 |
170 |
| - yield tconf.MSG_LEN_LIMIT |
171 |
| - print(old_value) |
172 |
| - tconf.MSG_LEN_LIMIT = old_value |
| 162 | + "{} != {}, LAST IS {}"\ |
| 163 | + .format(len(expected_messages), |
| 164 | + len(received_messages), |
| 165 | + received_messages[-1]) |
173 | 166 |
|
174 | 167 |
|
175 |
| -def testZStackSendRecvHugeDataUnderLimit(patch_msg_len, tdir, looper, tconf): |
| 168 | +def testZStackSendRecvHugeDataUnderLimit(tdir, looper, tconf): |
176 | 169 | names = ['Alpha', 'Beta']
|
177 | 170 | genKeys(tdir, names)
|
178 | 171 |
|
@@ -209,7 +202,7 @@ def recvHandlerBeta(wrpMsg):
|
209 | 202 | assert betaHandler[0] is True
|
210 | 203 |
|
211 | 204 |
|
212 |
| -def testZStackSendHugeDataOverLimit(patch_msg_len, tdir, looper, tconf): |
| 205 | +def testZStackSendHugeDataOverLimit(tdir, looper, tconf): |
213 | 206 | names = ['Alpha', 'Beta']
|
214 | 207 | genKeys(tdir, names)
|
215 | 208 |
|
@@ -254,7 +247,7 @@ def rejectHandlerBeta(reason, frm):
|
254 | 247 | assert betaHandlers[1] is False
|
255 | 248 |
|
256 | 249 |
|
257 |
| -def testZStackRecvHugeDataOverLimit(patch_msg_len, tdir, looper, tconf): |
| 250 | +def testZStackRecvHugeDataOverLimit(tdir, looper, tconf): |
258 | 251 | names = ['Alpha', 'Beta']
|
259 | 252 | genKeys(tdir, names)
|
260 | 253 |
|
|
0 commit comments