Skip to content

Commit 9152dc6

Browse files
committed
Redesign Behavior.getParamValues() to return all parameter values
1 parent 675d875 commit 9152dc6

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

quark/script/__init__.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -129,29 +129,22 @@ def hasUrl(self) -> List[str]:
129129
"""
130130
return self.hasString(URL_REGEX, True)
131131

132-
def getParamValues(self) -> Tuple[str, str]:
133-
"""Get first and second parameter values from behavior.
132+
def getParamValues(self) -> List[str]:
133+
"""Get parameter values from behavior.
134134
135-
:return: strings of first and second parameter values
135+
:return: python containing parameter values
136136
"""
137137
allResult = self.hasString(".*", True)
138138

139-
secondParam = None
140-
firstParam = None
139+
paramValues = []
141140
for result in allResult:
142141
if result[0] == "(" and result[-1] == ")" and \
143142
self.firstAPI.innerObj.class_name in result and \
144143
self.secondAPI.innerObj.class_name in result:
145144

146-
params = result[1:-1].split(",")[1:]
147-
secondParam = None
145+
paramValues = result[1:-1].split(",")[1:]
148146

149-
if len(params) >= 1:
150-
firstParam = params[0]
151-
if len(params) >= 2:
152-
secondParam = params[1]
153-
154-
return firstParam, secondParam
147+
return paramValues
155148

156149

157150
class QuarkResult:

tests/script/test_script.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,7 @@ def testGetParamValues(QUARK_ANALYSIS_RESULT):
181181
)
182182
)
183183

184-
first_api, second_api = behavior.getParamValues()
185-
186-
assert first_api == "ping www.baidu.com" and second_api is None
184+
assert behavior.getParamValues()[0] == "ping www.baidu.com"
187185

188186

189187
class TestQuarkReuslt:

0 commit comments

Comments
 (0)