synapse 2.196.0__py311-none-any.whl → 2.197.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 +12 -8
- synapse/cryotank.py +2 -2
- synapse/lib/cell.py +2 -2
- synapse/lib/config.py +3 -3
- synapse/lib/multislabseqn.py +2 -2
- synapse/lib/schemas.py +478 -1
- synapse/lib/storm.py +12 -394
- synapse/lib/stormlib/graph.py +0 -61
- synapse/lib/stormlib/index.py +52 -0
- synapse/lib/stormtypes.py +3 -1
- synapse/lib/task.py +13 -2
- synapse/lib/urlhelp.py +1 -1
- synapse/lib/version.py +2 -2
- synapse/models/doc.py +62 -0
- synapse/models/orgs.py +6 -4
- synapse/tests/test_datamodel.py +7 -0
- synapse/tests/test_lib_aha.py +0 -40
- synapse/tests/test_lib_boss.py +15 -6
- synapse/tests/test_lib_cell.py +43 -0
- synapse/tests/test_lib_stormlib_index.py +39 -0
- synapse/tests/test_lib_task.py +31 -13
- synapse/tests/test_model_doc.py +38 -0
- synapse/tests/test_model_orgs.py +7 -0
- synapse/tools/genpkg.py +2 -2
- {synapse-2.196.0.dist-info → synapse-2.197.0.dist-info}/METADATA +1 -1
- {synapse-2.196.0.dist-info → synapse-2.197.0.dist-info}/RECORD +29 -27
- {synapse-2.196.0.dist-info → synapse-2.197.0.dist-info}/LICENSE +0 -0
- {synapse-2.196.0.dist-info → synapse-2.197.0.dist-info}/WHEEL +0 -0
- {synapse-2.196.0.dist-info → synapse-2.197.0.dist-info}/top_level.txt +0 -0
synapse/models/doc.py
CHANGED
|
@@ -77,6 +77,30 @@ class DocModule(s_module.CoreModule):
|
|
|
77
77
|
'documents': 'standards',
|
|
78
78
|
'type': 'doc:standard:type:taxonomy'},
|
|
79
79
|
'doc': 'A group of requirements which define how to implement a policy or goal.'}),
|
|
80
|
+
|
|
81
|
+
('doc:requirement:type:taxonomy', ('taxonomy', {}), {
|
|
82
|
+
'interfaces': ('meta:taxonomy',),
|
|
83
|
+
'doc': 'A taxonomy of requirement types.'}),
|
|
84
|
+
|
|
85
|
+
('doc:requirement', ('guid', {}), {
|
|
86
|
+
'interfaces': ('doc:document',),
|
|
87
|
+
'template': {
|
|
88
|
+
'document': 'requirement',
|
|
89
|
+
'documents': 'requirements',
|
|
90
|
+
'type': 'doc:requirement:type:taxonomy'},
|
|
91
|
+
'doc': 'A single requirement, often defined by a standard.'}),
|
|
92
|
+
|
|
93
|
+
('doc:resume:type:taxonomy', ('taxonomy', {}), {
|
|
94
|
+
'interfaces': ('meta:taxonomy',),
|
|
95
|
+
'doc': 'A taxonomy of resume types.'}),
|
|
96
|
+
|
|
97
|
+
('doc:resume', ('guid', {}), {
|
|
98
|
+
'interfaces': ('doc:document',),
|
|
99
|
+
'template': {
|
|
100
|
+
'document': 'resume',
|
|
101
|
+
'documents': 'resumes',
|
|
102
|
+
'type': 'doc:resume:type:taxonomy'},
|
|
103
|
+
'doc': 'A CV/resume document.'}),
|
|
80
104
|
),
|
|
81
105
|
'forms': (
|
|
82
106
|
|
|
@@ -88,6 +112,44 @@ class DocModule(s_module.CoreModule):
|
|
|
88
112
|
('policy', ('doc:policy', {}), {
|
|
89
113
|
'doc': 'The policy which was used to derive the standard.'}),
|
|
90
114
|
)),
|
|
115
|
+
|
|
116
|
+
('doc:requirement:type:taxonomy', {}, ()),
|
|
117
|
+
('doc:requirement', {}, (
|
|
118
|
+
|
|
119
|
+
('summary', ('str', {}), {
|
|
120
|
+
'disp': {'hint': 'text'},
|
|
121
|
+
'doc': 'A summary of the requirement definition.'}),
|
|
122
|
+
|
|
123
|
+
('optional', ('bool', {}), {
|
|
124
|
+
'doc': 'Set to true if the requirement is optional as defined by the standard.'}),
|
|
125
|
+
|
|
126
|
+
('priority', ('meta:priority', {}), {
|
|
127
|
+
'doc': 'The priority of the requirement as defined by the standard.'}),
|
|
128
|
+
|
|
129
|
+
('standard', ('doc:standard', {}), {
|
|
130
|
+
'doc': 'The standard which defined the requirement.'}),
|
|
131
|
+
)),
|
|
132
|
+
|
|
133
|
+
('doc:resume:type:taxonomy', {}, ()),
|
|
134
|
+
('doc:resume', {}, (
|
|
135
|
+
|
|
136
|
+
('contact', ('ps:contact', {}), {
|
|
137
|
+
'doc': 'Contact information for subject of the resume.'}),
|
|
138
|
+
|
|
139
|
+
('summary', ('str', {}), {
|
|
140
|
+
'disp': {'hint': 'text'},
|
|
141
|
+
'doc': 'The summary of qualifications from the resume.'}),
|
|
142
|
+
|
|
143
|
+
('workhist', ('array', {'type': 'ps:workhist', 'sorted': True, 'uniq': True}), {
|
|
144
|
+
'doc': 'Work history described in the resume.'}),
|
|
145
|
+
|
|
146
|
+
('education', ('array', {'type': 'ps:education', 'sorted': True, 'uniq': True}), {
|
|
147
|
+
'doc': 'Education experience described in the resume.'}),
|
|
148
|
+
|
|
149
|
+
('achievements', ('array', {'type': 'ps:achievement', 'sorted': True, 'uniq': True}), {
|
|
150
|
+
'doc': 'Achievements described in the resume.'}),
|
|
151
|
+
|
|
152
|
+
)),
|
|
91
153
|
),
|
|
92
154
|
'edges': (),
|
|
93
155
|
}),)
|
synapse/models/orgs.py
CHANGED
|
@@ -93,9 +93,10 @@ class OuModule(s_module.CoreModule):
|
|
|
93
93
|
('ou:industryname', ('str', {'lower': True, 'onespace': True}), {
|
|
94
94
|
'doc': 'The name of an industry.',
|
|
95
95
|
}),
|
|
96
|
-
('ou:alias', ('str', {'lower': True, 'regex': r'^[
|
|
97
|
-
'
|
|
96
|
+
('ou:alias', ('str', {'lower': True, 'regex': r'^[\w0-9_]+$'}), {
|
|
97
|
+
'deprecated': True,
|
|
98
98
|
'ex': 'vertexproject',
|
|
99
|
+
'doc': 'Deprecated. Please use ou:name.',
|
|
99
100
|
}),
|
|
100
101
|
('ou:hasalias', ('comp', {'fields': (('org', 'ou:org'), ('alias', 'ou:alias'))}), {
|
|
101
102
|
'deprecated': True,
|
|
@@ -762,7 +763,8 @@ class OuModule(s_module.CoreModule):
|
|
|
762
763
|
'doc': 'A list of alternate names for the organization.',
|
|
763
764
|
}),
|
|
764
765
|
('alias', ('ou:alias', {}), {
|
|
765
|
-
'
|
|
766
|
+
'deprecated': True,
|
|
767
|
+
'doc': 'Deprecated. Please use ou:org:names.',
|
|
766
768
|
}),
|
|
767
769
|
('phone', ('tel:phone', {}), {
|
|
768
770
|
'doc': 'The primary phone number for the organization.',
|
|
@@ -1373,7 +1375,7 @@ class OuModule(s_module.CoreModule):
|
|
|
1373
1375
|
('org', ('ou:org', {}), {
|
|
1374
1376
|
'doc': 'The organization which is enacting the document.'}),
|
|
1375
1377
|
|
|
1376
|
-
('doc', ('ndef', {'forms': ('doc:policy', 'doc:standard')}), {
|
|
1378
|
+
('doc', ('ndef', {'forms': ('doc:policy', 'doc:standard', 'doc:requirement')}), {
|
|
1377
1379
|
'doc': 'The document enacted by the organization.'}),
|
|
1378
1380
|
|
|
1379
1381
|
('scope', ('ndef', {}), {
|
synapse/tests/test_datamodel.py
CHANGED
|
@@ -2,6 +2,7 @@ import synapse.exc as s_exc
|
|
|
2
2
|
import synapse.datamodel as s_datamodel
|
|
3
3
|
|
|
4
4
|
import synapse.lib.module as s_module
|
|
5
|
+
import synapse.lib.schemas as s_schemas
|
|
5
6
|
|
|
6
7
|
import synapse.cortex as s_cortex
|
|
7
8
|
|
|
@@ -342,3 +343,9 @@ class DataModelTest(s_t_utils.SynTest):
|
|
|
342
343
|
nodes = await core.nodes('[ it:prod:softver=* :semver=3.1.0 ]')
|
|
343
344
|
self.none(nodes[0].get('semver:major'))
|
|
344
345
|
self.eq(1, nodes[0].get('semver:minor'))
|
|
346
|
+
|
|
347
|
+
def test_datamodel_schema_basetypes(self):
|
|
348
|
+
# N.B. This test is to keep synapse.lib.schemas.datamodel_basetypes const
|
|
349
|
+
# in sync with the default s_datamodel.Datamodel().types
|
|
350
|
+
basetypes = list(s_datamodel.Model().types)
|
|
351
|
+
self.eq(s_schemas.datamodel_basetypes, basetypes)
|
synapse/tests/test_lib_aha.py
CHANGED
|
@@ -1434,46 +1434,6 @@ class AhaTest(s_test.SynTest):
|
|
|
1434
1434
|
self.len(nexsindx, items)
|
|
1435
1435
|
self.true(all(item[1][0] for item in items))
|
|
1436
1436
|
|
|
1437
|
-
# test some of the gather API implementations...
|
|
1438
|
-
purl00 = await aha.addAhaSvcProv('0.cell')
|
|
1439
|
-
purl01 = await aha.addAhaSvcProv('1.cell', provinfo={'mirror': '0.cell'})
|
|
1440
|
-
|
|
1441
|
-
cell00 = await aha.enter_context(self.getTestCell(conf={'aha:provision': purl00}))
|
|
1442
|
-
cell01 = await aha.enter_context(self.getTestCell(conf={'aha:provision': purl01}))
|
|
1443
|
-
|
|
1444
|
-
await cell01.sync()
|
|
1445
|
-
|
|
1446
|
-
async def sleep99(cell):
|
|
1447
|
-
await cell.boss.promote('sleep99', cell.auth.rootuser)
|
|
1448
|
-
await cell00.fire('sleep99')
|
|
1449
|
-
await asyncio.sleep(99)
|
|
1450
|
-
|
|
1451
|
-
async with cell00.waiter(2, 'sleep99', timeout=2):
|
|
1452
|
-
task00 = cell00.schedCoro(sleep99(cell00))
|
|
1453
|
-
task01 = cell01.schedCoro(sleep99(cell01))
|
|
1454
|
-
|
|
1455
|
-
proxy = await aha.enter_context(aha.getLocalProxy())
|
|
1456
|
-
tasks = [task async for task in cell00.getTasks(timeout=3)]
|
|
1457
|
-
self.len(2, tasks)
|
|
1458
|
-
self.eq(tasks[0]['service'], '0.cell.synapse')
|
|
1459
|
-
self.eq(tasks[1]['service'], '1.cell.synapse')
|
|
1460
|
-
|
|
1461
|
-
self.eq(tasks[0], await cell00.getTask(tasks[0].get('iden')))
|
|
1462
|
-
self.eq(tasks[1], await cell00.getTask(tasks[1].get('iden')))
|
|
1463
|
-
self.none(await cell00.getTask(tasks[1].get('iden'), peers=False))
|
|
1464
|
-
|
|
1465
|
-
self.true(await cell00.killTask(tasks[0].get('iden')))
|
|
1466
|
-
|
|
1467
|
-
task01 = tasks[1].get('iden')
|
|
1468
|
-
self.false(await cell00.killTask(task01, peers=False))
|
|
1469
|
-
|
|
1470
|
-
self.true(await cell00.killTask(task01))
|
|
1471
|
-
|
|
1472
|
-
self.none(await cell00.getTask(task01))
|
|
1473
|
-
self.false(await cell00.killTask(task01))
|
|
1474
|
-
|
|
1475
|
-
self.none(await cell00.getAhaProxy(feats=(('newp', 9),)))
|
|
1476
|
-
|
|
1477
1437
|
async def test_lib_aha_peer_api(self):
|
|
1478
1438
|
|
|
1479
1439
|
async with self.getTestAha() as aha:
|
synapse/tests/test_lib_boss.py
CHANGED
|
@@ -3,13 +3,21 @@ import asyncio
|
|
|
3
3
|
import synapse.exc as s_exc
|
|
4
4
|
import synapse.common as s_common
|
|
5
5
|
import synapse.lib.boss as s_boss
|
|
6
|
+
import synapse.lib.cell as s_cell
|
|
6
7
|
import synapse.tests.utils as s_test
|
|
7
8
|
|
|
9
|
+
class BossCell(s_cell.Cell):
|
|
10
|
+
async def initServiceRuntime(self):
|
|
11
|
+
self.cboss = await s_boss.Boss.anit()
|
|
12
|
+
self.onfini(self.cboss)
|
|
13
|
+
|
|
8
14
|
class BossTest(s_test.SynTest):
|
|
9
15
|
|
|
10
16
|
async def test_boss_base(self):
|
|
11
17
|
|
|
12
|
-
async with
|
|
18
|
+
async with self.getTestCell(BossCell) as bcell:
|
|
19
|
+
boss = bcell.cboss
|
|
20
|
+
root = await bcell.auth.getUserByName('root')
|
|
13
21
|
|
|
14
22
|
evnt = asyncio.Event()
|
|
15
23
|
|
|
@@ -20,18 +28,19 @@ class BossTest(s_test.SynTest):
|
|
|
20
28
|
|
|
21
29
|
self.len(0, boss.ps())
|
|
22
30
|
|
|
23
|
-
synt = await boss.promote('test',
|
|
31
|
+
synt = await boss.promote('test', root, info={'hehe': 'haha'})
|
|
24
32
|
|
|
25
33
|
self.len(1, boss.ps())
|
|
26
34
|
|
|
27
35
|
self.eq('test', synt.name)
|
|
28
36
|
self.eq('haha', synt.info.get('hehe'))
|
|
37
|
+
self.eq(root.iden, synt.user.iden)
|
|
29
38
|
|
|
30
|
-
synt0 = await boss.execute(testloop(), 'testloop',
|
|
39
|
+
synt0 = await boss.execute(testloop(), 'testloop', root, info={'foo': 'bar'})
|
|
31
40
|
iden = synt0.iden
|
|
32
41
|
|
|
33
42
|
with self.raises(s_exc.BadArg):
|
|
34
|
-
_ = await boss.execute(asyncio.sleep(1), 'testsleep',
|
|
43
|
+
_ = await boss.execute(asyncio.sleep(1), 'testsleep', root, iden=iden)
|
|
35
44
|
|
|
36
45
|
await evnt.wait()
|
|
37
46
|
|
|
@@ -47,8 +56,8 @@ class BossTest(s_test.SynTest):
|
|
|
47
56
|
iden = s_common.guid()
|
|
48
57
|
|
|
49
58
|
async def double_promote():
|
|
50
|
-
await boss.promote(f'double',
|
|
51
|
-
await boss.promote(f'double',
|
|
59
|
+
await boss.promote(f'double', root, taskiden=iden)
|
|
60
|
+
await boss.promote(f'double', root, taskiden=iden + iden)
|
|
52
61
|
|
|
53
62
|
coro = boss.schedCoro(double_promote())
|
|
54
63
|
self.true(await stream.wait(timeout=6))
|
synapse/tests/test_lib_cell.py
CHANGED
|
@@ -3417,3 +3417,46 @@ class CellTest(s_t_utils.SynTest):
|
|
|
3417
3417
|
pass
|
|
3418
3418
|
async for item in cell.callPeerGenr(todo):
|
|
3419
3419
|
pass
|
|
3420
|
+
|
|
3421
|
+
async def test_cell_task_apis(self):
|
|
3422
|
+
async with self.getTestAha() as aha:
|
|
3423
|
+
|
|
3424
|
+
# test some of the gather API implementations...
|
|
3425
|
+
purl00 = await aha.addAhaSvcProv('00.cell')
|
|
3426
|
+
purl01 = await aha.addAhaSvcProv('01.cell', provinfo={'mirror': 'cell'})
|
|
3427
|
+
|
|
3428
|
+
cell00 = await aha.enter_context(self.getTestCell(conf={'aha:provision': purl00}))
|
|
3429
|
+
cell01 = await aha.enter_context(self.getTestCell(conf={'aha:provision': purl01}))
|
|
3430
|
+
|
|
3431
|
+
await cell01.sync()
|
|
3432
|
+
|
|
3433
|
+
async def sleep99(cell):
|
|
3434
|
+
await cell.boss.promote('sleep99', cell.auth.rootuser)
|
|
3435
|
+
await cell00.fire('sleep99')
|
|
3436
|
+
await asyncio.sleep(99)
|
|
3437
|
+
|
|
3438
|
+
async with cell00.waiter(2, 'sleep99', timeout=6):
|
|
3439
|
+
task00 = cell00.schedCoro(sleep99(cell00))
|
|
3440
|
+
task01 = cell01.schedCoro(sleep99(cell01))
|
|
3441
|
+
|
|
3442
|
+
tasks = [task async for task in cell00.getTasks(timeout=6)]
|
|
3443
|
+
|
|
3444
|
+
self.len(2, tasks)
|
|
3445
|
+
self.eq(tasks[0]['service'], '00.cell.synapse')
|
|
3446
|
+
self.eq(tasks[1]['service'], '01.cell.synapse')
|
|
3447
|
+
self.eq(('sleep99', 'sleep99'), [task.get('name') for task in tasks])
|
|
3448
|
+
self.eq(('root', 'root'), [task.get('username') for task in tasks])
|
|
3449
|
+
|
|
3450
|
+
self.eq(tasks[0], await cell00.getTask(tasks[0].get('iden')))
|
|
3451
|
+
self.eq(tasks[1], await cell00.getTask(tasks[1].get('iden')))
|
|
3452
|
+
self.none(await cell00.getTask(tasks[1].get('iden'), peers=False))
|
|
3453
|
+
|
|
3454
|
+
self.true(await cell00.killTask(tasks[0].get('iden')))
|
|
3455
|
+
|
|
3456
|
+
task01 = tasks[1].get('iden')
|
|
3457
|
+
self.false(await cell00.killTask(task01, peers=False))
|
|
3458
|
+
|
|
3459
|
+
self.true(await cell00.killTask(task01))
|
|
3460
|
+
|
|
3461
|
+
self.none(await cell00.getTask(task01))
|
|
3462
|
+
self.false(await cell00.killTask(task01))
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import synapse.tests.utils as s_test
|
|
2
|
+
|
|
3
|
+
count_prop_00 = '''
|
|
4
|
+
Count | Layer Iden | Layer Name
|
|
5
|
+
==============|==================================|============
|
|
6
|
+
16 | 5cc56afbb22fad9b96c51110812af8f7 |
|
|
7
|
+
16 | 2371390b1fd0162ba6820f85a863e7b2 | default
|
|
8
|
+
Total: 32
|
|
9
|
+
'''
|
|
10
|
+
|
|
11
|
+
count_prop_01 = '''
|
|
12
|
+
Count | Layer Iden | Layer Name
|
|
13
|
+
==============|==================================|============
|
|
14
|
+
16 | 9782c920718d3059b8806fddaf917bd8 |
|
|
15
|
+
0 | 511122a9b2d576c5be2cdfcaef541bb9 | default
|
|
16
|
+
Total: 16
|
|
17
|
+
'''
|
|
18
|
+
|
|
19
|
+
class StormIndexTest(s_test.SynTest):
|
|
20
|
+
|
|
21
|
+
async def test_lib_stormlib_index(self):
|
|
22
|
+
|
|
23
|
+
async with self.getTestCore() as core:
|
|
24
|
+
viewiden = await core.callStorm('return($lib.view.get().fork().iden)')
|
|
25
|
+
viewopts = {'view': viewiden}
|
|
26
|
+
await core.nodes('[ inet:ipv4=1.2.3.0/28 :asn=19 ]')
|
|
27
|
+
await core.nodes('[ inet:ipv4=1.2.4.0/28 :asn=42 ]', opts=viewopts)
|
|
28
|
+
|
|
29
|
+
msgs = await core.stormlist('index.count.prop inet:ipv4', opts=viewopts)
|
|
30
|
+
self.stormIsInPrint(count_prop_00, msgs, deguid=True, whitespace=False)
|
|
31
|
+
|
|
32
|
+
msgs = await core.stormlist('index.count.prop inet:ipv4:asn', opts=viewopts)
|
|
33
|
+
self.stormIsInPrint(count_prop_00, msgs, deguid=True, whitespace=False)
|
|
34
|
+
|
|
35
|
+
msgs = await core.stormlist('index.count.prop inet:ipv4:asn --value 42', opts=viewopts)
|
|
36
|
+
self.stormIsInPrint(count_prop_01, msgs, deguid=True, whitespace=False)
|
|
37
|
+
|
|
38
|
+
msgs = await core.stormlist('index.count.prop inet:ipv4:newp', opts=viewopts)
|
|
39
|
+
self.stormIsInErr('No property named inet:ipv4:newp', msgs)
|
synapse/tests/test_lib_task.py
CHANGED
|
@@ -2,12 +2,14 @@ import asyncio
|
|
|
2
2
|
|
|
3
3
|
import synapse.exc as s_exc
|
|
4
4
|
import synapse.lib.boss as s_boss
|
|
5
|
+
import synapse.lib.cell as s_cell
|
|
5
6
|
import synapse.lib.task as s_task
|
|
6
7
|
import synapse.tests.utils as s_test
|
|
7
8
|
|
|
8
|
-
class
|
|
9
|
-
def
|
|
10
|
-
self.
|
|
9
|
+
class BossCell(s_cell.Cell):
|
|
10
|
+
async def initServiceRuntime(self):
|
|
11
|
+
self.cboss = await s_boss.Boss.anit()
|
|
12
|
+
self.onfini(self.cboss)
|
|
11
13
|
|
|
12
14
|
class TaskTest(s_test.SynTest):
|
|
13
15
|
|
|
@@ -19,15 +21,27 @@ class TaskTest(s_test.SynTest):
|
|
|
19
21
|
|
|
20
22
|
async def test_task_module(self):
|
|
21
23
|
|
|
22
|
-
async with
|
|
24
|
+
async with self.getTestCell(BossCell) as bcell:
|
|
25
|
+
boss = bcell.cboss
|
|
26
|
+
root = await bcell.auth.getUserByName('root')
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
synt = await boss.promote('test', root, info={'hehe': 'haha'})
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
self.eq(s_task.user(), user)
|
|
30
|
+
self.eq(s_task.user(), root)
|
|
29
31
|
self.eq(s_task.current(), synt)
|
|
30
|
-
self.eq(s_task.username(), '
|
|
32
|
+
self.eq(s_task.username(), 'root')
|
|
33
|
+
|
|
34
|
+
ret = synt.pack()
|
|
35
|
+
self.nn(ret.pop('iden'))
|
|
36
|
+
self.nn(ret.pop('tick'))
|
|
37
|
+
self.eq(ret, {'name': 'test', 'info': {'hehe': 'haha'},
|
|
38
|
+
'user': 'root', 'kids': {}})
|
|
39
|
+
|
|
40
|
+
ret = synt.packv2()
|
|
41
|
+
self.nn(ret.pop('iden'))
|
|
42
|
+
self.nn(ret.pop('tick'))
|
|
43
|
+
self.eq(ret, {'name': 'test', 'info': {'hehe': 'haha'},
|
|
44
|
+
'user': root.iden, 'username': 'root', 'kids': {}})
|
|
31
45
|
|
|
32
46
|
async def test_taskvars(self):
|
|
33
47
|
s_task.varset('test', 'foo')
|
|
@@ -51,7 +65,11 @@ class TaskTest(s_test.SynTest):
|
|
|
51
65
|
self.eq(s_task.varget('test'), 'foo')
|
|
52
66
|
|
|
53
67
|
async def test_task_iden(self):
|
|
54
|
-
with self.
|
|
55
|
-
await
|
|
56
|
-
|
|
57
|
-
|
|
68
|
+
async with self.getTestCell(BossCell) as bcell:
|
|
69
|
+
root = await bcell.auth.getUserByName('root')
|
|
70
|
+
boss = bcell.cboss
|
|
71
|
+
|
|
72
|
+
with self.raises(s_exc.BadArg):
|
|
73
|
+
await s_task.Task.anit(boss, asyncio.current_task(), None, root, iden=10)
|
|
74
|
+
with self.raises(s_exc.BadArg):
|
|
75
|
+
await s_task.Task.anit(boss, asyncio.current_task(), None, root, iden='woot')
|
synapse/tests/test_model_doc.py
CHANGED
|
@@ -49,3 +49,41 @@ class DocModelTest(s_tests.SynTest):
|
|
|
49
49
|
self.eq('V-99', nodes[0].get('id'))
|
|
50
50
|
self.nn(nodes[0].get('policy'))
|
|
51
51
|
self.len(1, await core.nodes('doc:standard -> doc:policy'))
|
|
52
|
+
|
|
53
|
+
nodes = await core.nodes('''
|
|
54
|
+
[ doc:requirement=*
|
|
55
|
+
:id=V-99
|
|
56
|
+
:priority=low
|
|
57
|
+
:optional=(false)
|
|
58
|
+
:summary="Some requirement text."
|
|
59
|
+
:standard={doc:standard}
|
|
60
|
+
]
|
|
61
|
+
''')
|
|
62
|
+
self.eq('V-99', nodes[0].get('id'))
|
|
63
|
+
self.eq('Some requirement text.', nodes[0].get('summary'))
|
|
64
|
+
self.eq(20, nodes[0].get('priority'))
|
|
65
|
+
self.false(nodes[0].get('optional'))
|
|
66
|
+
self.nn(nodes[0].get('standard'))
|
|
67
|
+
self.len(1, await core.nodes('doc:requirement -> doc:standard'))
|
|
68
|
+
|
|
69
|
+
nodes = await core.nodes('''
|
|
70
|
+
[ doc:resume=*
|
|
71
|
+
:id=V-99
|
|
72
|
+
:contact={[ ps:contact=* :name=visi ]}
|
|
73
|
+
:summary="Thought leader seeks..."
|
|
74
|
+
:workhist={[ ps:workhist=* ]}
|
|
75
|
+
:education={[ ps:education=* ]}
|
|
76
|
+
:achievements={[ ps:achievement=* ]}
|
|
77
|
+
]
|
|
78
|
+
''')
|
|
79
|
+
self.eq('V-99', nodes[0].get('id'))
|
|
80
|
+
self.eq('Thought leader seeks...', nodes[0].get('summary'))
|
|
81
|
+
self.nn(nodes[0].get('contact'))
|
|
82
|
+
self.len(1, nodes[0].get('workhist'))
|
|
83
|
+
self.len(1, nodes[0].get('education'))
|
|
84
|
+
self.len(1, nodes[0].get('achievements'))
|
|
85
|
+
|
|
86
|
+
self.len(1, await core.nodes('doc:resume :contact -> ps:contact'))
|
|
87
|
+
self.len(1, await core.nodes('doc:resume :workhist -> ps:workhist'))
|
|
88
|
+
self.len(1, await core.nodes('doc:resume :education -> ps:education'))
|
|
89
|
+
self.len(1, await core.nodes('doc:resume :achievements -> ps:achievement'))
|
synapse/tests/test_model_orgs.py
CHANGED
|
@@ -183,6 +183,13 @@ class OuModelTest(s_t_utils.SynTest):
|
|
|
183
183
|
self.eq(t.norm('HAHA1')[0], 'haha1')
|
|
184
184
|
self.eq(t.norm('GOV_MFA')[0], 'gov_mfa')
|
|
185
185
|
|
|
186
|
+
# ou:org:alias (unicode test)
|
|
187
|
+
nodes = await core.nodes('''
|
|
188
|
+
[ ou:org=* :alias="ÅÆØåæø" ]
|
|
189
|
+
''')
|
|
190
|
+
self.len(1, nodes)
|
|
191
|
+
self.eq(t.norm('ÅÆØåæø')[0], 'åæøåæø')
|
|
192
|
+
|
|
186
193
|
# ou:position / ou:org:subs
|
|
187
194
|
orgiden = s_common.guid()
|
|
188
195
|
contact = s_common.guid()
|
synapse/tools/genpkg.py
CHANGED
|
@@ -12,10 +12,10 @@ import synapse.exc as s_exc
|
|
|
12
12
|
import synapse.common as s_common
|
|
13
13
|
import synapse.telepath as s_telepath
|
|
14
14
|
|
|
15
|
-
import synapse.lib.storm as s_storm
|
|
16
15
|
import synapse.lib.output as s_output
|
|
17
16
|
import synapse.lib.certdir as s_certdir
|
|
18
17
|
import synapse.lib.dyndeps as s_dyndeps
|
|
18
|
+
import synapse.lib.schemas as s_schemas
|
|
19
19
|
|
|
20
20
|
logger = logging.getLogger(__name__)
|
|
21
21
|
|
|
@@ -221,7 +221,7 @@ def loadPkgProto(path, opticdir=None, no_docs=False, readonly=False):
|
|
|
221
221
|
pkgdef['optic'].setdefault('files', {})
|
|
222
222
|
loadOpticFiles(pkgdef, opticdir)
|
|
223
223
|
|
|
224
|
-
|
|
224
|
+
s_schemas.reqValidPkgdef(pkgdef)
|
|
225
225
|
|
|
226
226
|
# Ensure the package is json safe and tuplify it.
|
|
227
227
|
s_common.reqJsonSafeStrict(pkgdef)
|