Skip to content

Commit

Permalink
feat(response): added getCommandPlain (getting used command in plain …
Browse files Browse the repository at this point in the history
…text)
  • Loading branch information
KaiSchwarz-cnic committed Apr 30, 2020
1 parent ffe2dbc commit 2efab17
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hexonet/apiconnector/response.py
Expand Up @@ -104,6 +104,15 @@ def getCommand(self):
"""
return self.__command

def getCommandPlain(self):
"""
Get Command used in this request in plain text
"""
tmp = ''
for key, val in self.__command.items():
tmp += "%s = %s\n" % (key, val)
return tmp

def getCurrentPageNumber(self):
"""
Get Page Number of current List Query
Expand Down
9 changes: 9 additions & 0 deletions tests/test_response.py
Expand Up @@ -40,6 +40,15 @@ def test_responsemethods():
r = R(RP.serialize(h))
assert r.getFirstRecordIndex() == 0

# #.getCommandPlain()
r = R("", {
"COMMAND": "QueryDomainOptions",
"DOMAIN0": "example.com",
"DOMAIN1": "example.net"
})
expected = "COMMAND = QueryDomainOptions\nDOMAIN0 = example.com\nDOMAIN1 = example.net\n"
assert r.getCommandPlain() == expected

# #.getColumns()
r = R(rtm.getTemplate('listP0').getPlain())
cols = r.getColumns()
Expand Down

0 comments on commit 2efab17

Please sign in to comment.