@@ -1072,12 +1072,19 @@ def test_audit_shellcommandtask_file(tmpdir):
1072
1072
with open ("test.txt" , "w" ) as f :
1073
1073
f .write ("This is a test" )
1074
1074
1075
+ with open ("test2.txt" , "w" ) as f :
1076
+ f .write ("This is a test" )
1077
+
1075
1078
# copy the test.txt file to the tmpdir
1076
1079
shutil .copy ("test.txt" , tmpdir )
1080
+ shutil .copy ("test2.txt" , tmpdir )
1081
+
1077
1082
1078
1083
cmd = "cat"
1079
1084
file_in = tmpdir / "test.txt"
1085
+ file_in_2 = tmpdir / "test2.txt"
1080
1086
test_file_hash = hash_file (file_in )
1087
+ test_file_hash_2 = hash_file (file_in_2 )
1081
1088
my_input_spec = SpecInfo (
1082
1089
name = "Input" ,
1083
1090
fields = [
@@ -1092,13 +1099,26 @@ def test_audit_shellcommandtask_file(tmpdir):
1092
1099
"mandatory" : True ,
1093
1100
},
1094
1101
),
1102
+ ),
1103
+ (
1104
+ "in_file_2" ,
1105
+ attr .ib (
1106
+ type = File ,
1107
+ metadata = {
1108
+ "position" : 2 ,
1109
+ "argstr" : "" ,
1110
+ "help_string" : "text" ,
1111
+ "mandatory" : True ,
1112
+ },
1113
+ ),
1095
1114
),
1096
1115
],
1097
1116
bases = (ShellSpec ,),
1098
1117
)
1099
1118
shelly = ShellCommandTask (
1100
1119
name = "shelly" ,
1101
1120
in_file = file_in ,
1121
+ in_file_2 = file_in_2 ,
1102
1122
input_spec = my_input_spec ,
1103
1123
executable = cmd ,
1104
1124
audit_flags = AuditFlag .PROV ,
@@ -1112,11 +1132,12 @@ def test_audit_shellcommandtask_file(tmpdir):
1112
1132
data = json .load (x )
1113
1133
if "@type" in data :
1114
1134
if data ["@type" ] == "input" :
1115
- if "AtLocation" in data :
1135
+ if data [ "Label" ] == "in_file" :
1116
1136
assert data ["AtLocation" ] == str (file_in )
1117
- if "digest" in data :
1118
- assert data ["digest" ] == test_file_hash
1119
-
1137
+ assert data ["digest" ] == test_file_hash
1138
+ if data ["Label" ] == "in_file_2" :
1139
+ assert data ["AtLocation" ] == str (file_in_2 )
1140
+ assert data ["digest" ] == test_file_hash_2
1120
1141
1121
1142
def test_audit_shellcommandtask_version (tmpdir ):
1122
1143
import subprocess as sp
0 commit comments