Skip to content

Commit c7c9884

Browse files
committed
not really py3 related test bugfixes
1 parent 814fcd9 commit c7c9884

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

tests/unittests/test_hec_obj.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,28 @@ def test_hec__send_trivially(mock_send):
1313
hec.sendEvent({'test': 'test-tacular'})
1414
assert json.loads(mock_send.call_args.args[0].dat)['test'] == 'test-tacular'
1515

16-
@mock.patch.object(HEC, '_send') # just in case, not actually used
16+
@mock.patch.object(HEC, '_send')
1717
def test_queue_things_with_compression(mock_send, __opts__, __salt__):
1818
hec = HEC('token', 'index', 'server',
1919
disk_queue=TEST_DQ_DIR, disk_queue_size=1000,
2020
disk_queue_compression=9)
2121

22+
hec.queue.clear()
23+
2224
results_of_side_effect = list()
23-
def side_effect(x):
24-
results_of_side_effect.append(x)
25+
def side_effect(x, **kw):
26+
if 'xxx-mytest-xxx' in x:
27+
results_of_side_effect.append(x)
2528
mock_send.side_effect = side_effect
2629

2730
gz = list()
28-
for i in range(100):
29-
dat = {f'event{i}': f'test{i}'}
31+
for i in range(1):
32+
dat = {f'event{i}': f'-xxx-mytest-xxx-test{i}'}
3033
hec.queueEvent(dat)
3134
gz.append( json.dumps(dat) )
3235
hec.flushQueue()
33-
assert ' '.join(results_of_side_effect) == ' '.join(gz)
36+
37+
cat_rez = ' '.join(results_of_side_effect)
38+
cat_gz = ' '.join(gz)
39+
40+
assert cat_rez == cat_gz

0 commit comments

Comments
 (0)