@@ -1008,8 +1008,6 @@ def testfunc(a: int, b: float = 0.1) -> ty.NamedTuple("Output", [("out", float)]
1008
1008
funky ()
1009
1009
message_path = tmpdir / funky .checksum / "messages"
1010
1010
print (message_path )
1011
- # go through each jsonld file in message_path and check if the label field exists
1012
- json_content = []
1013
1011
1014
1012
for file in glob (str (message_path ) + "/*.jsonld" ):
1015
1013
with open (file , "r" ) as f :
@@ -1023,7 +1021,7 @@ def testfunc(a: int, b: float = 0.1) -> ty.NamedTuple("Output", [("out", float)]
1023
1021
assert None == data ["Label" ]
1024
1022
# placeholder for atlocation until
1025
1023
# new test is added
1026
- assert None == data ["AtLocation" ]
1024
+ assert [] == data ["AtLocation" ]
1027
1025
1028
1026
# assert data["Type"] == "input"
1029
1027
@@ -1072,13 +1070,19 @@ def test_audit_shellcommandtask(tmpdir):
1072
1070
1073
1071
1074
1072
def test_audit_shellcommandtask_file (tmpdir ):
1073
+ import shutil
1075
1074
# create test.txt file with "This is a test" in it in the tmpdir
1076
1075
with open (tmpdir / "test.txt" , "w" ) as f :
1077
1076
f .write ("This is a test." )
1077
+ # make a copy of the test.txt file in the tmpdir and name it test2.txt
1078
+ shutil .copy (tmpdir / "test.txt" , tmpdir / "test2.txt" )
1079
+
1078
1080
1079
1081
cmd = "cat"
1080
1082
file_in = tmpdir / "test.txt"
1083
+ file_in_2 = tmpdir / "test2.txt"
1081
1084
test_file_hash = hash_file (file_in )
1085
+ test_file_hash_2 = hash_file (file_in_2 )
1082
1086
my_input_spec = SpecInfo (
1083
1087
name = "Input" ,
1084
1088
fields = [
@@ -1093,13 +1097,26 @@ def test_audit_shellcommandtask_file(tmpdir):
1093
1097
"mandatory" : True ,
1094
1098
},
1095
1099
),
1100
+ ),
1101
+ (
1102
+ "in_file_2" ,
1103
+ attr .ib (
1104
+ type = File ,
1105
+ metadata = {
1106
+ "position" : 2 ,
1107
+ "argstr" : "" ,
1108
+ "help_string" : "text" ,
1109
+ "mandatory" : True ,
1110
+ },
1111
+ ),
1096
1112
)
1097
1113
],
1098
1114
bases = (ShellSpec ,),
1099
1115
)
1100
1116
shelly = ShellCommandTask (
1101
1117
name = "shelly" ,
1102
1118
in_file = file_in ,
1119
+ in_file_2 = file_in_2 ,
1103
1120
input_spec = my_input_spec ,
1104
1121
executable = cmd ,
1105
1122
audit_flags = AuditFlag .PROV ,
@@ -1113,9 +1130,9 @@ def test_audit_shellcommandtask_file(tmpdir):
1113
1130
data = json .load (f )
1114
1131
print (file_in )
1115
1132
if "AtLocation" in data :
1116
- assert data ["AtLocation" ] == str ( file_in )
1133
+ assert data ["AtLocation" ] == [ file_in , file_in_2 ]
1117
1134
if "digest" in data :
1118
- assert test_file_hash == data ["digest" ]
1135
+ assert data ["digest" ] == [ test_file_hash , test_file_hash_2 ]
1119
1136
1120
1137
1121
1138
def test_audit_shellcommandtask_version (tmpdir ):
0 commit comments