@@ -998,22 +998,29 @@ def testfunc(a: int, b: float = 0.1) -> ty.NamedTuple("Output", [("out", float)]
998
998
funky .cache_dir = tmpdir
999
999
funky ()
1000
1000
message_path = tmpdir / funky .checksum / "messages"
1001
+ print (message_path )
1001
1002
# go through each jsonld file in message_path and check if the label field exists
1002
1003
json_content = []
1003
1004
1004
1005
for file in glob (str (message_path ) + "/*.jsonld" ):
1005
1006
with open (file , "r" ) as f :
1006
1007
data = json .load (f )
1007
- print (data )
1008
- if "Activity_Label" in data :
1009
- json_content .append (True )
1010
- assert data ["Activity_Label" ] == "testfunc"
1011
- if "Entity_Label" in data :
1012
- assert data ["Entity_Label" ] == None
1008
+ if "@type" in data :
1009
+ if "AssociatedWith" in data :
1010
+ assert "testfunc" in data ["Label" ]
1011
+
1012
+
1013
+
1014
+ if "@type" in data :
1015
+ if data ["@type" ] == "input" :
1016
+ assert None == data ["Label" ]
1017
+
1018
+ #assert data["Type"] == "input"
1019
+
1013
1020
if "AssociatedWith" in data :
1014
1021
assert None == data ["AssociatedWith" ]
1015
1022
1016
- assert any (json_content )
1023
+ # assert any(json_content)
1017
1024
1018
1025
1019
1026
def test_audit_shellcommandtask (tmpdir ):
@@ -1032,21 +1039,29 @@ def test_audit_shellcommandtask(tmpdir):
1032
1039
shelly ()
1033
1040
message_path = tmpdir / shelly .checksum / "messages"
1034
1041
# go through each jsonld file in message_path and check if the label field exists
1035
- label_content = []
1042
+
1036
1043
command_content = []
1037
1044
1038
1045
for file in glob (str (message_path ) + "/*.jsonld" ):
1039
1046
with open (file , "r" ) as f :
1040
1047
data = json .load (f )
1041
- print (data )
1042
- if "Activity_Label" in data :
1043
- label_content .append (True )
1048
+ if "@type" in data :
1049
+ if "AssociatedWith" in data :
1050
+ assert "shelly" in data ["Label" ]
1051
+
1052
+
1053
+
1054
+ if "@type" in data :
1055
+ if data ["@type" ] == "input" :
1056
+ assert None == data ["Label" ]
1057
+
1058
+
1044
1059
if "Command" in data :
1045
1060
command_content .append (True )
1046
1061
assert "ls -l" == data ["Command" ]
1047
1062
1048
- print ( command_content )
1049
- assert any (label_content )
1063
+
1064
+ assert any (command_content )
1050
1065
1051
1066
1052
1067
def test_audit_shellcommandtask_version (tmpdir ):
0 commit comments