synapse 2.193.0__py311-none-any.whl → 2.195.0__py311-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of synapse might be problematic. Click here for more details.
- synapse/cortex.py +9 -7
- synapse/datamodel.py +9 -6
- synapse/exc.py +1 -1
- synapse/lib/agenda.py +17 -4
- synapse/lib/ast.py +217 -86
- synapse/lib/auth.py +5 -2
- synapse/lib/link.py +33 -19
- synapse/lib/modelrev.py +6 -1
- synapse/lib/parser.py +4 -0
- synapse/lib/scrape.py +18 -1
- synapse/lib/snap.py +40 -11
- synapse/lib/storm.lark +16 -1
- synapse/lib/storm.py +6 -4
- synapse/lib/storm_format.py +1 -0
- synapse/lib/stormctrl.py +88 -6
- synapse/lib/stormlib/auth.py +15 -1
- synapse/lib/stormlib/cache.py +6 -2
- synapse/lib/stormlib/cell.py +11 -0
- synapse/lib/stormlib/infosec.py +2 -0
- synapse/lib/stormlib/scrape.py +1 -1
- synapse/lib/stormlib/stix.py +8 -8
- synapse/lib/stormtypes.py +13 -5
- synapse/lib/version.py +2 -2
- synapse/lib/view.py +20 -3
- synapse/models/geopol.py +1 -0
- synapse/models/geospace.py +53 -10
- synapse/models/inet.py +3 -0
- synapse/models/infotech.py +12 -5
- synapse/models/material.py +67 -8
- synapse/models/orgs.py +11 -3
- synapse/models/person.py +28 -17
- synapse/models/risk.py +4 -1
- synapse/models/syn.py +3 -0
- synapse/models/telco.py +10 -3
- synapse/models/transport.py +382 -49
- synapse/tests/test_axon.py +6 -6
- synapse/tests/test_cortex.py +134 -12
- synapse/tests/test_exc.py +1 -0
- synapse/tests/test_lib_agenda.py +125 -1
- synapse/tests/test_lib_aha.py +13 -6
- synapse/tests/test_lib_ast.py +258 -9
- synapse/tests/test_lib_auth.py +6 -7
- synapse/tests/test_lib_cell.py +10 -0
- synapse/tests/test_lib_grammar.py +14 -0
- synapse/tests/test_lib_layer.py +1 -1
- synapse/tests/test_lib_link.py +6 -1
- synapse/tests/test_lib_lmdbslab.py +3 -3
- synapse/tests/test_lib_modelrev.py +7 -0
- synapse/tests/test_lib_scrape.py +8 -0
- synapse/tests/test_lib_storm.py +201 -25
- synapse/tests/test_lib_stormctrl.py +65 -0
- synapse/tests/test_lib_stormhttp.py +5 -5
- synapse/tests/test_lib_stormlib_auth.py +31 -5
- synapse/tests/test_lib_stormlib_cache.py +38 -6
- synapse/tests/test_lib_stormlib_cell.py +3 -0
- synapse/tests/test_lib_stormlib_modelext.py +3 -3
- synapse/tests/test_lib_stormlib_scrape.py +4 -4
- synapse/tests/test_lib_stormlib_spooled.py +1 -1
- synapse/tests/test_lib_stormlib_xml.py +5 -5
- synapse/tests/test_lib_stormtypes.py +54 -57
- synapse/tests/test_lib_view.py +1 -1
- synapse/tests/test_model_base.py +1 -2
- synapse/tests/test_model_geopol.py +4 -0
- synapse/tests/test_model_geospace.py +43 -4
- synapse/tests/test_model_inet.py +3 -0
- synapse/tests/test_model_infotech.py +31 -4
- synapse/tests/test_model_material.py +18 -0
- synapse/tests/test_model_orgs.py +25 -3
- synapse/tests/test_model_person.py +26 -1
- synapse/tests/test_model_risk.py +11 -0
- synapse/tests/test_model_syn.py +9 -3
- synapse/tests/test_model_transport.py +168 -0
- synapse/tests/test_telepath.py +24 -5
- synapse/tests/test_tools_healthcheck.py +4 -4
- synapse/tests/test_utils.py +17 -18
- synapse/tests/utils.py +0 -35
- synapse/tools/changelog.py +14 -5
- synapse/tools/storm.py +1 -1
- {synapse-2.193.0.dist-info → synapse-2.195.0.dist-info}/METADATA +5 -5
- {synapse-2.193.0.dist-info → synapse-2.195.0.dist-info}/RECORD +83 -82
- {synapse-2.193.0.dist-info → synapse-2.195.0.dist-info}/WHEEL +1 -1
- {synapse-2.193.0.dist-info → synapse-2.195.0.dist-info}/LICENSE +0 -0
- {synapse-2.193.0.dist-info → synapse-2.195.0.dist-info}/top_level.txt +0 -0
synapse/tests/test_lib_ast.py
CHANGED
|
@@ -292,11 +292,11 @@ class AstTest(s_test.SynTest):
|
|
|
292
292
|
async with self.getTestCore() as core:
|
|
293
293
|
q = '''
|
|
294
294
|
[test:str=another :hehe=asdf]
|
|
295
|
-
$s =
|
|
295
|
+
$s = ("Foo",)
|
|
296
296
|
$newvar=:hehe
|
|
297
297
|
-.created
|
|
298
|
-
$s.
|
|
299
|
-
$lib.print($
|
|
298
|
+
$s.append("yar {x}", x=$newvar)
|
|
299
|
+
$lib.print($lib.str.join('', $s))
|
|
300
300
|
'''
|
|
301
301
|
mesgs = await core.stormlist(q)
|
|
302
302
|
prints = [m[1]['mesg'] for m in mesgs if m[0] == 'print']
|
|
@@ -405,6 +405,93 @@ class AstTest(s_test.SynTest):
|
|
|
405
405
|
q = 'test:str=foo $newp=($node.repr(), bar) [*$newp=foo]'
|
|
406
406
|
await self.asyncraises(s_exc.StormRuntimeError, core.nodes(q))
|
|
407
407
|
|
|
408
|
+
async def test_ast_condsetoper(self):
|
|
409
|
+
async with self.getTestCore() as core:
|
|
410
|
+
|
|
411
|
+
q = '$var=hehe $foo=unset [test:str=foo :$var*unset=heval]'
|
|
412
|
+
nodes = await core.nodes(q)
|
|
413
|
+
self.len(1, nodes)
|
|
414
|
+
self.eq('heval', nodes[0].get('hehe'))
|
|
415
|
+
|
|
416
|
+
q = '$var=hehe $foo=unset [test:str=foo :$var*unset=newp]'
|
|
417
|
+
nodes = await core.nodes(q)
|
|
418
|
+
self.len(1, nodes)
|
|
419
|
+
self.eq('heval', nodes[0].get('hehe'))
|
|
420
|
+
|
|
421
|
+
q = '$var=hehe $foo=unset [test:str=foo :$var*$foo=newp]'
|
|
422
|
+
nodes = await core.nodes(q)
|
|
423
|
+
self.len(1, nodes)
|
|
424
|
+
self.eq('heval', nodes[0].get('hehe'))
|
|
425
|
+
|
|
426
|
+
q = '$var=hehe $foo=always [test:str=foo :$var*$foo=yep]'
|
|
427
|
+
nodes = await core.nodes(q)
|
|
428
|
+
self.len(1, nodes)
|
|
429
|
+
self.eq('yep', nodes[0].get('hehe'))
|
|
430
|
+
|
|
431
|
+
q = '[test:str=foo -:hehe]'
|
|
432
|
+
nodes = await core.nodes(q)
|
|
433
|
+
self.len(1, nodes)
|
|
434
|
+
self.none(nodes[0].get('hehe'))
|
|
435
|
+
|
|
436
|
+
q = '$var=hehe $foo=never [test:str=foo :$var*$foo=yep]'
|
|
437
|
+
nodes = await core.nodes(q)
|
|
438
|
+
self.len(1, nodes)
|
|
439
|
+
self.none(nodes[0].get('hehe'))
|
|
440
|
+
|
|
441
|
+
q = '$var=hehe $foo=unset [test:str=foo :$var*$foo=heval]'
|
|
442
|
+
nodes = await core.nodes(q)
|
|
443
|
+
self.len(1, nodes)
|
|
444
|
+
self.eq('heval', nodes[0].get('hehe'))
|
|
445
|
+
|
|
446
|
+
with self.raises(s_exc.BadTypeValu):
|
|
447
|
+
q = '$var=tick $foo=always [test:str=foo :$var*$foo=heval]'
|
|
448
|
+
nodes = await core.nodes(q)
|
|
449
|
+
|
|
450
|
+
q = '$var=tick $foo=always [test:str=foo :$var*$foo?=heval]'
|
|
451
|
+
nodes = await core.nodes(q)
|
|
452
|
+
self.len(1, nodes)
|
|
453
|
+
self.none(nodes[0].get('tick'))
|
|
454
|
+
|
|
455
|
+
q = '''
|
|
456
|
+
$opts=({"tick": "unset", "hehe": "always"})
|
|
457
|
+
[ test:str=foo
|
|
458
|
+
:hehe*$opts.hehe=newv
|
|
459
|
+
:tick*$opts.tick?=2020]
|
|
460
|
+
'''
|
|
461
|
+
nodes = await core.nodes(q)
|
|
462
|
+
self.len(1, nodes)
|
|
463
|
+
self.eq('newv', nodes[0].get('hehe'))
|
|
464
|
+
tick = nodes[0].get('tick')
|
|
465
|
+
self.nn(tick)
|
|
466
|
+
|
|
467
|
+
q = '''
|
|
468
|
+
$opts=({"tick": "never", "hehe": "unset"})
|
|
469
|
+
[ test:str=foo
|
|
470
|
+
:hehe*$opts.hehe=newp
|
|
471
|
+
:tick*$opts.tick?=2020]
|
|
472
|
+
'''
|
|
473
|
+
nodes = await core.nodes(q)
|
|
474
|
+
self.len(1, nodes)
|
|
475
|
+
self.eq('newv', nodes[0].get('hehe'))
|
|
476
|
+
self.eq(tick, nodes[0].get('tick'))
|
|
477
|
+
|
|
478
|
+
q = '$foo=always [test:str=foo :tick*$foo?=2021]'
|
|
479
|
+
nodes = await core.nodes(q)
|
|
480
|
+
self.len(1, nodes)
|
|
481
|
+
self.ne(tick, nodes[0].get('tick'))
|
|
482
|
+
|
|
483
|
+
with self.raises(s_exc.IsReadOnly):
|
|
484
|
+
q = '[test:str=foo :hehe*unset=heval]'
|
|
485
|
+
nodes = await core.nodes(q, opts={'readonly': True})
|
|
486
|
+
|
|
487
|
+
with self.raises(s_exc.NoSuchProp):
|
|
488
|
+
q = '[test:str=foo :newp*unset=heval]'
|
|
489
|
+
nodes = await core.nodes(q)
|
|
490
|
+
|
|
491
|
+
with self.raises(s_exc.StormRuntimeError):
|
|
492
|
+
q = '$foo=newp [test:str=foo :hehe*$foo=heval]'
|
|
493
|
+
nodes = await core.nodes(q)
|
|
494
|
+
|
|
408
495
|
async def test_ast_editparens(self):
|
|
409
496
|
|
|
410
497
|
async with self.getTestCore() as core:
|
|
@@ -1070,10 +1157,10 @@ class AstTest(s_test.SynTest):
|
|
|
1070
1157
|
|
|
1071
1158
|
nodes = await core.nodes('[ test:arrayprop="*" :ints=(1, 2, 3) ]')
|
|
1072
1159
|
nodes = await core.nodes('[ test:arrayprop="*" :ints=(100, 101, 102) ]')
|
|
1073
|
-
nodes = await core.nodes('test:arrayprop +:ints
|
|
1160
|
+
nodes = await core.nodes('test:arrayprop +:ints=([1,2,3])')
|
|
1074
1161
|
self.len(1, nodes)
|
|
1075
1162
|
|
|
1076
|
-
nodes = await core.nodes('test:arrayprop:ints
|
|
1163
|
+
nodes = await core.nodes('test:arrayprop:ints=([1,2,3])')
|
|
1077
1164
|
self.len(1, nodes)
|
|
1078
1165
|
|
|
1079
1166
|
with self.raises(s_exc.NoSuchProp):
|
|
@@ -1232,7 +1319,7 @@ class AstTest(s_test.SynTest):
|
|
|
1232
1319
|
nodes = await core.nodes(q)
|
|
1233
1320
|
self.len(1, nodes)
|
|
1234
1321
|
|
|
1235
|
-
nodes = await core.nodes('[ test:arrayprop=* :strs={return (
|
|
1322
|
+
nodes = await core.nodes('[ test:arrayprop=* :strs={return ((a,b,c,d))} ]')
|
|
1236
1323
|
self.len(1, nodes)
|
|
1237
1324
|
self.len(4, nodes[0].get('strs'))
|
|
1238
1325
|
|
|
@@ -1870,7 +1957,7 @@ class AstTest(s_test.SynTest):
|
|
|
1870
1957
|
self.len(0, await core.nodes('init { function x() { return((0)) } }'))
|
|
1871
1958
|
|
|
1872
1959
|
# Can't use a mutable variable as a default
|
|
1873
|
-
q = '$var
|
|
1960
|
+
q = '$var=([1,2,3]) function badargs(x=foo, y=$var) {} $badargs()'
|
|
1874
1961
|
msgs = await core.stormlist(q)
|
|
1875
1962
|
erfo = [m for m in msgs if m[0] == 'err'][0]
|
|
1876
1963
|
self.eq(erfo[1][0], 'StormRuntimeError')
|
|
@@ -2648,12 +2735,12 @@ class AstTest(s_test.SynTest):
|
|
|
2648
2735
|
|
|
2649
2736
|
q = 'function func(arg) { auth.user.addrule root $arg | return () } $func(hehe.haha)'
|
|
2650
2737
|
msgs = await core.stormlist(q, opts={'readonly': True})
|
|
2651
|
-
self.stormIsInErr('
|
|
2738
|
+
self.stormIsInErr('auth:user.addRule() is not marked readonly safe.', msgs)
|
|
2652
2739
|
|
|
2653
2740
|
async def test_ast_yield(self):
|
|
2654
2741
|
|
|
2655
2742
|
async with self.getTestCore() as core:
|
|
2656
|
-
q = '$nodes =
|
|
2743
|
+
q = '$nodes = () [ inet:asn=10 inet:asn=20 ] $nodes.append($node) | spin | yield $nodes'
|
|
2657
2744
|
nodes = await core.nodes(q)
|
|
2658
2745
|
self.len(2, nodes)
|
|
2659
2746
|
|
|
@@ -4437,3 +4524,165 @@ class AstTest(s_test.SynTest):
|
|
|
4437
4524
|
text = '($x, $y) = (1)'
|
|
4438
4525
|
with self.raises(s_exc.StormRuntimeError):
|
|
4439
4526
|
await core.nodes(text)
|
|
4527
|
+
|
|
4528
|
+
async def test_ast_functypes(self):
|
|
4529
|
+
|
|
4530
|
+
async with self.getTestCore() as core:
|
|
4531
|
+
|
|
4532
|
+
async def verify(q, isin=False):
|
|
4533
|
+
msgs = await core.stormlist(q)
|
|
4534
|
+
if isin:
|
|
4535
|
+
self.stormIsInPrint('yep', msgs)
|
|
4536
|
+
else:
|
|
4537
|
+
self.stormNotInPrint('newp', msgs)
|
|
4538
|
+
self.len(1, [m for m in msgs if m[0] == 'node'])
|
|
4539
|
+
self.stormHasNoErr(msgs)
|
|
4540
|
+
|
|
4541
|
+
q = '''
|
|
4542
|
+
function foo() {
|
|
4543
|
+
for $n in { return((newp,)) } { $lib.print($n) }
|
|
4544
|
+
}
|
|
4545
|
+
[ it:dev:str=test ]
|
|
4546
|
+
$foo()
|
|
4547
|
+
'''
|
|
4548
|
+
await verify(q)
|
|
4549
|
+
|
|
4550
|
+
q = '''
|
|
4551
|
+
function foo() {
|
|
4552
|
+
while { return((newp,)) } { $lib.print(newp) break }
|
|
4553
|
+
}
|
|
4554
|
+
[ it:dev:str=test ]
|
|
4555
|
+
$foo()
|
|
4556
|
+
'''
|
|
4557
|
+
await verify(q)
|
|
4558
|
+
|
|
4559
|
+
q = '''
|
|
4560
|
+
function foo() {
|
|
4561
|
+
switch $lib.print({ return(newp) }) { *: { $lib.print(newp) } }
|
|
4562
|
+
}
|
|
4563
|
+
[ it:dev:str=test ]
|
|
4564
|
+
$foo()
|
|
4565
|
+
'''
|
|
4566
|
+
await verify(q)
|
|
4567
|
+
|
|
4568
|
+
q = '''
|
|
4569
|
+
function foo() {
|
|
4570
|
+
switch $foo { *: { $lib.print(yep) return() } }
|
|
4571
|
+
}
|
|
4572
|
+
[ it:dev:str=test ]
|
|
4573
|
+
$foo()
|
|
4574
|
+
'''
|
|
4575
|
+
await verify(q, isin=True)
|
|
4576
|
+
|
|
4577
|
+
q = '''
|
|
4578
|
+
function foo() {
|
|
4579
|
+
if { return(newp) } { $lib.print(newp) }
|
|
4580
|
+
}
|
|
4581
|
+
[ it:dev:str=test ]
|
|
4582
|
+
$foo()
|
|
4583
|
+
'''
|
|
4584
|
+
await verify(q)
|
|
4585
|
+
|
|
4586
|
+
q = '''
|
|
4587
|
+
function foo() {
|
|
4588
|
+
if (false) { $lib.print(newp) }
|
|
4589
|
+
elif { return(newp) } { $lib.print(newp) }
|
|
4590
|
+
}
|
|
4591
|
+
[ it:dev:str=test ]
|
|
4592
|
+
$foo()
|
|
4593
|
+
'''
|
|
4594
|
+
await verify(q)
|
|
4595
|
+
|
|
4596
|
+
q = '''
|
|
4597
|
+
function foo() {
|
|
4598
|
+
if (false) { $lib.print(newp) }
|
|
4599
|
+
elif (true) { $lib.print(yep) return() }
|
|
4600
|
+
}
|
|
4601
|
+
[ it:dev:str=test ]
|
|
4602
|
+
$foo()
|
|
4603
|
+
'''
|
|
4604
|
+
await verify(q)
|
|
4605
|
+
|
|
4606
|
+
q = '''
|
|
4607
|
+
function foo() {
|
|
4608
|
+
if (false) { $lib.print(newp) }
|
|
4609
|
+
elif (false) { $lib.print(newp) }
|
|
4610
|
+
else { $lib.print(yep) return() }
|
|
4611
|
+
}
|
|
4612
|
+
[ it:dev:str=test ]
|
|
4613
|
+
$foo()
|
|
4614
|
+
'''
|
|
4615
|
+
await verify(q, isin=True)
|
|
4616
|
+
|
|
4617
|
+
q = '''
|
|
4618
|
+
function foo() {
|
|
4619
|
+
[ it:dev:str=foo +(refs)> { $lib.print(newp) return() } ]
|
|
4620
|
+
}
|
|
4621
|
+
[ it:dev:str=test ]
|
|
4622
|
+
$foo()
|
|
4623
|
+
'''
|
|
4624
|
+
await verify(q)
|
|
4625
|
+
|
|
4626
|
+
q = '''
|
|
4627
|
+
function foo() {
|
|
4628
|
+
$lib.print({ return(newp) })
|
|
4629
|
+
}
|
|
4630
|
+
[ it:dev:str=test ]
|
|
4631
|
+
$foo()
|
|
4632
|
+
'''
|
|
4633
|
+
await verify(q)
|
|
4634
|
+
|
|
4635
|
+
q = '''
|
|
4636
|
+
function foo() {
|
|
4637
|
+
$x = { $lib.print(newp) return() }
|
|
4638
|
+
}
|
|
4639
|
+
[ it:dev:str=test ]
|
|
4640
|
+
$foo()
|
|
4641
|
+
'''
|
|
4642
|
+
await verify(q)
|
|
4643
|
+
|
|
4644
|
+
q = '''
|
|
4645
|
+
function foo() {
|
|
4646
|
+
($x, $y) = { $lib.print(newp) return((foo, bar)) }
|
|
4647
|
+
}
|
|
4648
|
+
[ it:dev:str=test ]
|
|
4649
|
+
$foo()
|
|
4650
|
+
'''
|
|
4651
|
+
await verify(q)
|
|
4652
|
+
|
|
4653
|
+
q = '''
|
|
4654
|
+
function foo() {
|
|
4655
|
+
$x = ({})
|
|
4656
|
+
$x.y = { $lib.print(newp) return((foo, bar)) }
|
|
4657
|
+
}
|
|
4658
|
+
[ it:dev:str=test ]
|
|
4659
|
+
$foo()
|
|
4660
|
+
'''
|
|
4661
|
+
await verify(q)
|
|
4662
|
+
|
|
4663
|
+
q = '''
|
|
4664
|
+
function foo() {
|
|
4665
|
+
.created -({$lib.print(newp) return(refs)})> *
|
|
4666
|
+
}
|
|
4667
|
+
[ it:dev:str=test ]
|
|
4668
|
+
$foo()
|
|
4669
|
+
'''
|
|
4670
|
+
await verify(q)
|
|
4671
|
+
|
|
4672
|
+
q = '''
|
|
4673
|
+
function foo() {
|
|
4674
|
+
try { $lib.raise(boom) } catch { $lib.print(newp) return(newp) } as e {}
|
|
4675
|
+
}
|
|
4676
|
+
[ it:dev:str=test ]
|
|
4677
|
+
$foo()
|
|
4678
|
+
'''
|
|
4679
|
+
await verify(q)
|
|
4680
|
+
|
|
4681
|
+
q = '''
|
|
4682
|
+
function foo() {
|
|
4683
|
+
it:dev:str={ $lib.print(newp) return(test) }
|
|
4684
|
+
}
|
|
4685
|
+
[ it:dev:str=test ]
|
|
4686
|
+
$foo()
|
|
4687
|
+
'''
|
|
4688
|
+
await verify(q)
|
synapse/tests/test_lib_auth.py
CHANGED
|
@@ -495,7 +495,7 @@ class AuthTest(s_test.SynTest):
|
|
|
495
495
|
])
|
|
496
496
|
|
|
497
497
|
# Check sequences
|
|
498
|
-
seqmsg =
|
|
498
|
+
seqmsg = 'Password must not contain forward/reverse sequences longer than 3 characters.'
|
|
499
499
|
passwords = [
|
|
500
500
|
# letters
|
|
501
501
|
'abcA', 'dcbA', 'Abcd', 'Acba',
|
|
@@ -531,12 +531,8 @@ class AuthTest(s_test.SynTest):
|
|
|
531
531
|
'Password must contain at least 2 digit characters, 0 found.'
|
|
532
532
|
])
|
|
533
533
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
self.isin(
|
|
537
|
-
'Password must be at least 12 characters.',
|
|
538
|
-
exc.exception.get('failures')
|
|
539
|
-
)
|
|
534
|
+
# Setting password to None should work also
|
|
535
|
+
await core.setUserPasswd(user.iden, None)
|
|
540
536
|
|
|
541
537
|
# Attempting to add a user with a bad passwd will add the user and fail to set the password
|
|
542
538
|
with self.raises(s_exc.BadArg):
|
|
@@ -582,6 +578,9 @@ class AuthTest(s_test.SynTest):
|
|
|
582
578
|
await core.setUserPasswd(user.iden, pass2)
|
|
583
579
|
await core.setUserPasswd(user.iden, pass3)
|
|
584
580
|
|
|
581
|
+
# Setting password to None should work also
|
|
582
|
+
await core.setUserPasswd(user.iden, None)
|
|
583
|
+
|
|
585
584
|
with self.raises(s_exc.BadArg) as exc:
|
|
586
585
|
await core.setUserPasswd(user.iden, pass1)
|
|
587
586
|
self.eq(exc.exception.get('failures'), [
|
synapse/tests/test_lib_cell.py
CHANGED
|
@@ -1127,9 +1127,19 @@ class CellTest(s_t_utils.SynTest):
|
|
|
1127
1127
|
await proxy.addUserRole(visi['iden'], ninjas['iden'])
|
|
1128
1128
|
await proxy.setUserEmail(visi['iden'], 'visi@vertex.link')
|
|
1129
1129
|
|
|
1130
|
+
def1 = await core.getUserDef(visi['iden'])
|
|
1131
|
+
def2 = await core.getUserDef(visi['iden'])
|
|
1132
|
+
self.false(def1['authgates'] is def2['authgates'])
|
|
1133
|
+
self.eq(def1, def2)
|
|
1134
|
+
|
|
1130
1135
|
visi = await proxy.getUserDefByName('visi')
|
|
1131
1136
|
self.eq(visi['email'], 'visi@vertex.link')
|
|
1132
1137
|
|
|
1138
|
+
def1 = await core.getRoleDef(ninjas['iden'])
|
|
1139
|
+
def2 = await core.getRoleDef(ninjas['iden'])
|
|
1140
|
+
self.false(def1['authgates'] is def2['authgates'])
|
|
1141
|
+
self.eq(def1, def2)
|
|
1142
|
+
|
|
1133
1143
|
self.true(await proxy.isUserAllowed(visi['iden'], ('foo', 'bar')))
|
|
1134
1144
|
self.true(await proxy.isUserAllowed(visi['iden'], ('hehe', 'haha')))
|
|
1135
1145
|
|
|
@@ -728,6 +728,13 @@ Queries = [
|
|
|
728
728
|
'$pvar=stuff test:arrayprop +:$pvar*[=neato]',
|
|
729
729
|
'$pvar=ints test:arrayprop +:$pvar*[=$othervar]',
|
|
730
730
|
'$foo = ({"foo": ${ inet:fqdn }})',
|
|
731
|
+
'[test:str=foo :hehe*unset=heval]',
|
|
732
|
+
'[test:str=foo :hehe*$foo=heval]',
|
|
733
|
+
'[test:str=foo :$foo*unset=heval]',
|
|
734
|
+
'[test:str=foo :$foo*$bar=heval]',
|
|
735
|
+
'[test:str=foo :$foo*$bar.baz=heval]',
|
|
736
|
+
'[test:str=foo :$foo*$bar.("baz")=heval]',
|
|
737
|
+
'[test:str=foo :$foo*$bar.baz()=heval]',
|
|
731
738
|
]
|
|
732
739
|
|
|
733
740
|
# Generated with print_parse_list below
|
|
@@ -1358,6 +1365,13 @@ _ParseResults = [
|
|
|
1358
1365
|
'Query: [SetVarOper: [Const: pvar, Const: stuff], LiftProp: [Const: test:arrayprop], FiltOper: [Const: +, ArrayCond: [RelProp: [VarValue: [Const: pvar]], Const: =, Const: neato]]]',
|
|
1359
1366
|
'Query: [SetVarOper: [Const: pvar, Const: ints], LiftProp: [Const: test:arrayprop], FiltOper: [Const: +, ArrayCond: [RelProp: [VarValue: [Const: pvar]], Const: =, VarValue: [Const: othervar]]]]',
|
|
1360
1367
|
'Query: [SetVarOper: [Const: foo, DollarExpr: [ExprDict: [Const: foo, EmbedQuery: inet:fqdn]]]]',
|
|
1368
|
+
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditCondPropSet: [RelProp: [Const: hehe], CondSetOper: [Const: unset], Const: heval]]',
|
|
1369
|
+
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditCondPropSet: [RelProp: [Const: hehe], CondSetOper: [VarValue: [Const: foo]], Const: heval]]',
|
|
1370
|
+
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditCondPropSet: [RelProp: [VarValue: [Const: foo]], CondSetOper: [Const: unset], Const: heval]]',
|
|
1371
|
+
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditCondPropSet: [RelProp: [VarValue: [Const: foo]], CondSetOper: [VarValue: [Const: bar]], Const: heval]]',
|
|
1372
|
+
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditCondPropSet: [RelProp: [VarValue: [Const: foo]], CondSetOper: [VarDeref: [VarValue: [Const: bar], Const: baz]], Const: heval]]',
|
|
1373
|
+
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditCondPropSet: [RelProp: [VarValue: [Const: foo]], CondSetOper: [VarDeref: [VarValue: [Const: bar], DollarExpr: [Const: baz]]], Const: heval]]',
|
|
1374
|
+
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditCondPropSet: [RelProp: [VarValue: [Const: foo]], CondSetOper: [FuncCall: [VarDeref: [VarValue: [Const: bar], Const: baz], CallArgs: [], CallKwargs: []]], Const: heval]]',
|
|
1361
1375
|
]
|
|
1362
1376
|
|
|
1363
1377
|
class GrammarTest(s_t_utils.SynTest):
|
synapse/tests/test_lib_layer.py
CHANGED
synapse/tests/test_lib_link.py
CHANGED
|
@@ -4,6 +4,8 @@ import socket
|
|
|
4
4
|
import asyncio
|
|
5
5
|
import multiprocessing
|
|
6
6
|
|
|
7
|
+
import unittest.mock as mock
|
|
8
|
+
|
|
7
9
|
import synapse.exc as s_exc
|
|
8
10
|
import synapse.common as s_common
|
|
9
11
|
|
|
@@ -66,7 +68,10 @@ class LinkTest(s_test.SynTest):
|
|
|
66
68
|
info = link.getAddrInfo()
|
|
67
69
|
self.eq(info.get('family'), 'tcp')
|
|
68
70
|
self.eq(info.get('ipver'), 'ipv4')
|
|
69
|
-
|
|
71
|
+
|
|
72
|
+
with mock.patch('synapse.lib.link.MAXWRITE', 2):
|
|
73
|
+
await link.send(b'visi')
|
|
74
|
+
|
|
70
75
|
self.eq(b'vert', await link.recvsize(4))
|
|
71
76
|
self.none(await link.recvsize(1))
|
|
72
77
|
await link.fini()
|
|
@@ -338,9 +338,9 @@ class LmdbSlabTest(s_t_utils.SynTest):
|
|
|
338
338
|
|
|
339
339
|
# Ensure that our envar override for memory locking is acknowledged
|
|
340
340
|
with self.setTstEnvars(SYN_LOCKMEM_DISABLE='1'):
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
341
|
+
async with await s_lmdbslab.Slab.anit(path, map_size=1000000, lockmemory=True) as slab:
|
|
342
|
+
self.false(slab.lockmemory)
|
|
343
|
+
self.none(slab.memlocktask)
|
|
344
344
|
|
|
345
345
|
def simplenow(self):
|
|
346
346
|
self._nowtime += 1000
|
|
@@ -1759,3 +1759,10 @@ class ModelRevTest(s_tests.SynTest):
|
|
|
1759
1759
|
# There should be nothing in the default view
|
|
1760
1760
|
nodes = await core.nodes('.created')
|
|
1761
1761
|
self.len(0, nodes)
|
|
1762
|
+
|
|
1763
|
+
async def test_modelrev_0_2_32(self):
|
|
1764
|
+
async with self.getRegrCore('model-0.2.32') as core:
|
|
1765
|
+
nodes = await core.nodes('transport:air:craft')
|
|
1766
|
+
self.eq('foo bar', nodes[0].get('model'))
|
|
1767
|
+
nodes = await core.nodes('transport:sea:vessel')
|
|
1768
|
+
self.eq('foo bar', nodes[0].get('model'))
|
synapse/tests/test_lib_scrape.py
CHANGED
|
@@ -446,6 +446,10 @@ var/run/foo/
|
|
|
446
446
|
var/run/foo/bar
|
|
447
447
|
but they not have a open SDK :/.
|
|
448
448
|
'''
|
|
449
|
+
linux_paths += '\n' + '\n'.join([
|
|
450
|
+
'/bin' + '/long' * 1_024,
|
|
451
|
+
'/bin' + '/a' * 1_024,
|
|
452
|
+
])
|
|
449
453
|
|
|
450
454
|
windows_paths = '''
|
|
451
455
|
# GOOD PATHS
|
|
@@ -472,6 +476,10 @@ c:\\windows\\LPT1
|
|
|
472
476
|
c:\\foo.
|
|
473
477
|
dc:\\foo\\bar
|
|
474
478
|
'''
|
|
479
|
+
windows_paths += '\n' + '\n'.join([
|
|
480
|
+
'c:\\windows' + '\\long' * 7_000,
|
|
481
|
+
'c:\\windows' + '\\a' * 1_024,
|
|
482
|
+
])
|
|
475
483
|
|
|
476
484
|
good_uncs = [
|
|
477
485
|
'\\\\foo\\bar\\baz',
|