Skip to content

Commit

Permalink
Fix ping() unit test according to error message changed on PL6
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrdjan committed Mar 9, 2020
1 parent f7374a2 commit 689d12e
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ def test_version_and_options_getters(self):
assert "minor" in version
assert "patchLevel" in version
assert pyrfc.__version__ == VERSION
assert all(
k in self.conn.options for k in ("dtime", "return_import_params", "rstrip")
)
assert all(k in self.conn.options for k in ("dtime", "return_import_params", "rstrip"))

def test_connection_info(self):
connection_info = self.conn.get_connection_attributes()
Expand Down Expand Up @@ -115,9 +113,7 @@ def test_config_parameter(self):
result = self.conn.call("STFC_CONNECTION", REQUTEXT=hello)
assert "REQTEXT" not in result
# return import params
conn = pyrfc.Connection(
config={"return_import_params": True}, **config_sections["coevi51"]
)
conn = pyrfc.Connection(config={"return_import_params": True}, **config_sections["coevi51"])
result = conn.call("STFC_CONNECTION", REQUTEXT=hello.rstrip())
assert hello.rstrip() == result["REQUTEXT"]
conn.close()
Expand All @@ -132,7 +128,10 @@ def test_ping(self):
error = get_error(ex)
assert error["code"] == 13
assert error["key"] == "RFC_INVALID_HANDLE"
assert error["message"][0] == "An invalid handle was passed to the API call"
assert (
error["message"][0]
== "An invalid handle 'RFC_CONNECTION_HANDLE' was passed to the API call"
)

def test_RFM_name_string(self):
result = self.conn.call("STFC_CONNECTION", REQUTEXT=UNICODETEST)
Expand Down Expand Up @@ -173,9 +172,7 @@ def test_STFC_returns_structure_and_table(self):
row = IMPORTSTRUCT
row["RFCINT1"] = i
IMPORTTABLE.append(row)
result = self.conn.call(
"STFC_STRUCTURE", IMPORTSTRUCT=IMPORTSTRUCT, RFCTABLE=IMPORTTABLE
)
result = self.conn.call("STFC_STRUCTURE", IMPORTSTRUCT=IMPORTSTRUCT, RFCTABLE=IMPORTTABLE)
# ECHOSTRUCT match IMPORTSTRUCT
for k in IMPORTSTRUCT:
assert result["ECHOSTRUCT"][k] == IMPORTSTRUCT[k]
Expand Down Expand Up @@ -248,9 +245,7 @@ def test_STFC_CHANGING(self):
# STFC_CHANGING example with CHANGING parameters
start_value = 33
counter = 88
result = self.conn.call(
"STFC_CHANGING", START_VALUE=start_value, COUNTER=counter
)
result = self.conn.call("STFC_CHANGING", START_VALUE=start_value, COUNTER=counter)
assert result["COUNTER"] == counter + 1
assert result["RESULT"] == start_value + counter

Expand Down

0 comments on commit 689d12e

Please sign in to comment.