Skip to content

Commit c429972

Browse files
feat(responsetemplate): add isPending method
centralnicgroup-public/hexonet-api-documentation#1
1 parent fd4c2cb commit c429972

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

hexonet/apiconnector/responsetemplate.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,11 @@ def isTmpError(self):
9595
Check if current API response represents a temporary error case (4xx)
9696
"""
9797
return self.__hash["CODE"][0] == "4"
98+
99+
def isPending(self):
100+
"""
101+
Check if current operation is returned as pending
102+
"""
103+
if 'PENDING' in self.__hash:
104+
return self.__hash["PENDING"] == "1"
105+
return False

src/pytestcov

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 7205428bfb9ab9f8dbcaeefe23ce5fe426bb06b9
1+
Subproject commit 40826171fc78ea0bc11662624226464d06cee18c

tests/test_responsetemplate.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,11 @@ def test_responsetemplatemethods():
2525
assert tpl.getRuntime() == 0.00
2626
# [in api response]
2727
assert tpl2.getRuntime() == 0.12
28+
29+
# #.isPending
30+
# [not in api response]
31+
assert tpl.isPending() == False
32+
# [in api response]
33+
tpl2 = ResponseTemplate(
34+
'[RESPONSE]\r\ncode=423\r\ndescription=Empty API response\r\npending=1\r\nEOF\r\n')
35+
assert tpl2.isPending()

0 commit comments

Comments
 (0)