Skip to content

Commit ad239f4

Browse files
committed
update tests
1 parent 12364f0 commit ad239f4

File tree

7 files changed

+25
-22
lines changed

7 files changed

+25
-22
lines changed

synapse/lib/stormtypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2596,7 +2596,7 @@ class LibLift(Lib):
25962596
{'name': 'byNodeData', 'desc': 'Lift nodes which have a given nodedata name set on them.',
25972597
'type': {'type': 'function', '_funcname': '_byNodeData',
25982598
'args': (
2599-
{'name': 'name', 'desc': 'The name to of the nodedata key to lift by.', 'type': 'str', },
2599+
{'name': 'name', 'desc': 'The name of the nodedata key to lift by.', 'type': 'str', },
26002600
),
26012601
'returns': {'name': 'Yields', 'type': 'node',
26022602
'desc': 'Yields nodes to the pipeline. '

synapse/tests/test_lib_ast.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3435,19 +3435,19 @@ async def test_ast_highlight(self):
34353435
self.eq('obj.put(foo, bar, baz)', text[off:end])
34363436
self.stormIsInErr('pipe.put()', msgs)
34373437

3438-
text = '$lib.gen.campaign(foo, bar, baz)'
3438+
text = '$lib.lift.byNodeData(foo, bar, baz)'
34393439
msgs = await core.stormlist(text)
34403440
errm = [m for m in msgs if m[0] == 'err'][0]
34413441
off, end = errm[1][1]['highlight']['offsets']
3442-
self.eq('lib.gen.campaign(foo, bar, baz)', text[off:end])
3443-
self.stormIsInErr('$lib.gen.campaign()', msgs)
3442+
self.eq('lib.lift.byNodeData(foo, bar, baz)', text[off:end])
3443+
self.stormIsInErr('$lib.lift.byNodeData()', msgs)
34443444

3445-
text = '$gen = $lib.gen.campaign $gen(foo, bar, baz)'
3445+
text = '$lft = $lib.lift.byNodeData $lft(foo, bar, baz)'
34463446
msgs = await core.stormlist(text)
34473447
errm = [m for m in msgs if m[0] == 'err'][0]
34483448
off, end = errm[1][1]['highlight']['offsets']
3449-
self.eq('gen(foo, bar, baz)', text[off:end])
3450-
self.stormIsInErr('$lib.gen.campaign()', msgs)
3449+
self.eq('lft(foo, bar, baz)', text[off:end])
3450+
self.stormIsInErr('$lib.lift.byNodeData()', msgs)
34513451

34523452
async def highlighteq(exp, text):
34533453
msgs = await core.stormlist(text)

synapse/tests/test_lib_storm.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4324,12 +4324,12 @@ async def test_storm_help_cmd(self):
43244324
msgs = await core.stormlist('$str=hehe help $str.split')
43254325
self.stormIsInPrint('Split the string into multiple parts based on a separator.', msgs)
43264326

4327-
msgs = await core.stormlist('help $lib.gen.orgByName')
4328-
self.stormIsInPrint('Returns an ou:org by name, adding the node if it does not exist.', msgs)
4327+
msgs = await core.stormlist('help $lib.lift.byNodeData')
4328+
self.stormIsInPrint('Lift nodes which have a given nodedata name set on them.', msgs)
43294329

4330-
msgs = await core.stormlist('help --verbose $lib.gen.orgByName')
4331-
self.stormIsInPrint('Returns an ou:org by name, adding the node if it does not exist.\n'
4332-
'Args:\n name (str): The name of the org.', msgs)
4330+
msgs = await core.stormlist('help --verbose $lib.lift.byNodeData')
4331+
self.stormIsInPrint('Lift nodes which have a given nodedata name set on them.\n'
4332+
'Args:\n name (str): The name of the nodedata key to lift by.', msgs)
43334333

43344334
orig = s_stormtypes.registry.getLibDocs
43354335
def forcedep(cls):

synapse/tests/test_model_entity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ async def test_model_entity(self):
126126
:desc=Hehe
127127
:tag=woot.woot
128128
:sophistication=high
129-
:reporter=$lib.gen.orgByName(vertex)
129+
:reporter={[ ou:org=({"name": "vertex"}) ]}
130130
:reporter:name=vertex
131131
:parent={[ meta:technique=* :name=metawoot ]}
132132
]

synapse/tests/test_model_infotech.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ async def test_it_forms_simple(self):
513513
self.len(1, await core.nodes('it:log:event :service:account -> inet:service:account'))
514514
self.len(1, await core.nodes('it:log:event :service:platform -> inet:service:platform'))
515515

516-
nodes = await core.nodes('it:host | limit 1 | [ :keyboard:layout=qwerty :keyboard:language=$lib.gen.langByCode(en.us) ]')
516+
nodes = await core.nodes('it:host | limit 1 | [ :keyboard:layout=qwerty :keyboard:language={[ lang:language=({"code": "en.us"}) ]} ]')
517517
self.len(1, nodes)
518518
self.nn(nodes[0].get('keyboard:language'))
519519
self.len(1, await core.nodes('it:host:keyboard:layout=QWERTY'))

synapse/tests/test_model_language.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ async def test_model_language(self):
3030
self.len(1, await core.nodes('lang:translation -> it:software'))
3131
self.len(2, await core.nodes('lang:translation -> lang:language'))
3232

33-
self.none(await core.callStorm('return($lib.gen.langByCode(neeeeewp, try=$lib.true))'))
34-
with self.raises(s_exc.BadTypeValu):
35-
await core.callStorm('return($lib.gen.langByCode(neeeeewp))')
36-
3733
nodes = await core.nodes('[ lang:phrase="For The People" ]')
3834
self.len(1, nodes)
3935
self.eq('For The People', nodes[0].repr())

synapse/tests/test_model_transport.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ async def test_model_transport(self):
136136
nodes = await core.nodes('''
137137
$regid = $lib.guid()
138138
139+
$contact = {[
140+
entity:contact=({
141+
"type": "us.va.dmv",
142+
"email": "visi@vertex.link",
143+
})
144+
]}
145+
139146
[ transport:land:registration=$regid
140147
141148
:id=zeroday
@@ -144,23 +151,23 @@ async def test_model_transport(self):
144151
:issuer={gen.ou.org "virginia dmv"}
145152
:issuer:name="virginia dmv"
146153
147-
:contact={gen.ps.contact.email us.va.dmv visi@vertex.link}
154+
:contact=$contact
148155
149156
:vehicle={[ transport:land:vehicle=*
150157
:serial=V-31337
151158
:built=2005
152159
:model=elise
153160
:registration=$regid
154161
:type=car
155-
:owner={gen.ps.contact.email us.va.dmv visi@vertex.link}
162+
:owner=$contact
156163
]}
157164
158165
:license={[ transport:land:license=*
159166
:id=V-31337
160-
:contact={gen.ps.contact.email us.va.dmv visi@vertex.link}
167+
:contact=$contact
161168
:issued=20221217
162169
:expires=20251217
163-
:issuer={gen.ou.org "virginia dmv"}
170+
:issuer={[ ou:org=({"name": "virginia dmv"}) ]}
164171
:issuer:name="virginia dmv"
165172
]}
166173
]

0 commit comments

Comments
 (0)