Ejemplo n.º 1
0
    def test_RFC_RAISE_ERROR_AbapApplicationError(self):
        # Comment: cf. result_print of the error_test.py
        # '1_E': 'ABAPApplicationError-5-RAISE_EXCEPTION-ID:SR Type:E Number:006 STRING-True',
        # cf. ExceptionTest.c (l. 75ff)
        try:
            self.conn.call("RFC_RAISE_ERROR", METHOD="1", MESSAGETYPE="E")
        except pyrfc.ABAPApplicationError as ex:
            error = get_error(ex)
            assert error["code"] == 5
            assert error["key"] == "RAISE_EXCEPTION"
            assert error["msg_class"] == u"SR"
            assert error["msg_type"] == "E"
            assert error["msg_number"] == "006"
            # Assures that the connection handle is correctly synchronized
            self.conn.call("RFC_PING")

        # '2_E': 'ABAPApplicationError-5-RAISE_EXCEPTION- Number:000-True',
        # cf. ExceptionTest.c (l. 65ff)
        try:
            self.conn.call("RFC_RAISE_ERROR", METHOD="2", MESSAGETYPE="E")
        except pyrfc.ABAPApplicationError as ex:
            error = get_error(ex)
            assert error["code"] == 5
            assert error["key"] == "RAISE_EXCEPTION"
            assert error["msg_number"] == "006"
            self.conn.call("RFC_PING")
Ejemplo n.º 2
0
    def test_RFC_RAISE_ERROR_AbapApplicationError(self):
        # Comment: cf. result_print of the error_test.py
        # '1_E': 'ABAPApplicationError-5-RAISE_EXCEPTION-ID:SR Type:E Number:006 STRING-True',
        # cf. ExceptionTest.c (l. 75ff)
        try:
            self.conn.call('RFC_RAISE_ERROR', METHOD='1', MESSAGETYPE='E')
        except pyrfc.ABAPApplicationError as ex:
            error = get_error(ex)
            assert error['code'] == 5
            assert error['key'] == 'RAISE_EXCEPTION'
            assert error['msg_class'] == u'SR'
            assert error['msg_type'] == 'E'
            assert error['msg_number'] == '006'
            self.conn.call(
                'RFC_PING'
            )  # Assures that the connection handle is correctly synchronized

        # '2_E': 'ABAPApplicationError-5-RAISE_EXCEPTION- Number:000-True',
        # cf. ExceptionTest.c (l. 65ff)
        try:
            self.conn.call('RFC_RAISE_ERROR', METHOD='2', MESSAGETYPE='E')
        except pyrfc.ABAPApplicationError as ex:
            error = get_error(ex)
            assert error['code'] == 5
            assert error['key'] == 'RAISE_EXCEPTION'
            assert error['msg_number'] == '006'
            self.conn.call('RFC_PING')
    def test_RFC_RAISE_ERROR_AbapApplicationError(self):
        # Comment: cf. result_print of the error_test.py
        # '1_E': 'ABAPApplicationError-5-RAISE_EXCEPTION-ID:SR Type:E Number:006 STRING-True',
        # cf. ExceptionTest.c (l. 75ff)
        try:
            self.conn.call("RFC_RAISE_ERROR", METHOD="1", MESSAGETYPE="E")
        except pyrfc.ABAPApplicationError as ex:
            error = get_error(ex)
            assert error["code"] == 5
            assert error["key"] == "RAISE_EXCEPTION"
            assert error["msg_class"] == u"SR"
            assert error["msg_type"] == "E"
            assert error["msg_number"] == "006"
            # Assures that the connection handle is correctly synchronized
            self.conn.call("RFC_PING")

        # '2_E': 'ABAPApplicationError-5-RAISE_EXCEPTION- Number:000-True',
        # cf. ExceptionTest.c (l. 65ff)
        try:
            self.conn.call("RFC_RAISE_ERROR", METHOD="2", MESSAGETYPE="E")
        except pyrfc.ABAPApplicationError as ex:
            error = get_error(ex)
            assert error["code"] == 5
            assert error["key"] == "RAISE_EXCEPTION"
            assert error["msg_number"] == "006"
            self.conn.call("RFC_PING")
Ejemplo n.º 4
0
    def test_call_undefined(self):
        try:
            self.conn.call('undefined')
        except pyrfc.ABAPApplicationError as ex:
            error = get_error(ex)
        assert error['code'] == 5
        assert error['key'] == 'FU_NOT_FOUND'
        assert error['message'][0] == 'ID:FL Type:E Number:046 undefined'

        try:
            self.conn.call('STFC_CONNECTION', undefined=0)
        except pyrfc.ExternalRuntimeError as ex:
            error = get_error(ex)
        assert error['code'] == 20
        assert error['key'] == 'RFC_INVALID_PARAMETER'
        assert error['message'][0] == "field 'undefined' not found"
Ejemplo n.º 5
0
    def test_call_undefined(self):
        try:
            self.conn.call("undefined")
        except pyrfc.ABAPApplicationError as ex:
            error = get_error(ex)
        assert error["code"] == 5
        assert error["key"] == "FU_NOT_FOUND"
        assert error["message"][0] == "ID:FL Type:E Number:046 undefined"

        try:
            self.conn.call("STFC_CONNECTION", undefined=0)
        except pyrfc.ExternalRuntimeError as ex:
            error = get_error(ex)
        assert error["code"] == 20
        assert error["key"] == "RFC_INVALID_PARAMETER"
        assert error["message"][0] == "field 'undefined' not found"
Ejemplo n.º 6
0
 def test_STFC_SAPGUI(self):
     # STFC_SAPGUI RFC-TEST:   RFC with SAPGUI
     try:
         self.conn.call('STFC_SAPGUI')
     except (pyrfc.ABAPRuntimeError) as ex:
         error = get_error(ex)
         assert error['code'] == 3
         assert error['key'] == 'DYNPRO_SEND_IN_BACKGROUND'
Ejemplo n.º 7
0
 def test_call_non_existing_RFM_parameter(self):
     try:
         self.conn.call("STFC_CONNECTION", undefined=0)
     except ExternalRuntimeError as ex:
         error = get_error(ex)
     assert error["code"] == 20
     assert error["key"] == "RFC_INVALID_PARAMETER"
     assert error["message"][0] == "field 'undefined' not found"
Ejemplo n.º 8
0
 def test_call_non_existing_RFM(self):
     try:
         self.conn.call("undefined")
     except ABAPApplicationError as ex:
         error = get_error(ex)
     assert error["code"] == 5
     assert error["key"] == "FU_NOT_FOUND"
     assert error["message"][0] == "ID:FL Type:E Number:046 undefined"
 def test_STFC_SAPGUI(self):
     # STFC_SAPGUI RFC-TEST:   RFC with SAPGUI
     try:
         self.conn.call("STFC_SAPGUI")
     except (pyrfc.ABAPRuntimeError) as ex:
         error = get_error(ex)
         assert error["code"] == 3
         assert error["key"] == "DYNPRO_SEND_IN_BACKGROUND"
Ejemplo n.º 10
0
 def test_add_wrong_function(self):
     try:
         server.add_function("STFC_CONNECTION1", my_stfc_connection)
     except ABAPApplicationError as ex:
         error = get_error(ex)
         assert error["code"] == 5
         assert error["key"] == "FU_NOT_FOUND"
         assert error["message"][0] == "ID:FL Type:E Number:046 STFC_CONNECTION1"
Ejemplo n.º 11
0
 def test_RFC_RAISE_ERROR_AbapRuntimeError_E51(self):
     # '51_E': 'ABAPRuntimeError-3-BLOCKED_COMMIT-A database commit was blocked by the application.-True''] ==
     try:
         self.conn.call("RFC_RAISE_ERROR", METHOD="51", MESSAGETYPE="E")
     except (ABAPRuntimeError) as ex:
         assert self.conn.alive == True
         error = get_error(ex)
         assert error["code"] == 3
         assert error["key"] == "BLOCKED_COMMIT"
Ejemplo n.º 12
0
 def test_RFC_RAISE_ERROR_AbapRuntimeError_E36(self):
     # '36_E': 'ABAPRuntimeError-4-Division by 0 (type I)-Division by 0 (type I)-True''] ==
     try:
         self.conn.call("RFC_RAISE_ERROR", METHOD="36", MESSAGETYPE="E")
     except (ABAPRuntimeError) as ex:
         assert self.conn.alive == True
         error = get_error(ex)
         assert error["code"] == 4
         assert u"Division by 0" in error["message"][0]
Ejemplo n.º 13
0
 def test_RFC_RAISE_ERROR_AbapRuntimeError_E3(self):
     # '3_E': 'ABAPRuntimeError-3-COMPUTE_INT_ZERODIVIDE-Division by 0 (type I)-True''] ==
     # cf. ExceptionTest.c (l. 164ff)
     try:
         self.conn.call("RFC_RAISE_ERROR", METHOD="3", MESSAGETYPE="E")
     except (ABAPRuntimeError) as ex:
         assert self.conn.alive == True
         error = get_error(ex)
         assert error["code"] == 3
         assert error["key"] == "COMPUTE_INT_ZERODIVIDE"
Ejemplo n.º 14
0
    def test_denied_users(self):
        denied_params = params.copy()
        denied_params['user'] = '******'
        try:
            pyrfc.Connection(**denied_params)
        except pyrfc.LogonError as ex:
            error = get_error(ex)

        assert error['code'] == 2
        assert error['key'] == 'RFC_LOGON_FAILURE'
        assert error['message'][0] == 'Name or password is incorrect (repeat logon)'
Ejemplo n.º 15
0
 def test_RFC_RAISE_ERROR_AbapRuntimeError_E0(self):
     # RFC_RAISE_ERROR ARFC: Raise Different Type of Error Message
     # Comment: cf. result_print of the error_test.py
     # cf. ExceptionTest.c (l. 92ff)
     try:
         self.conn.call("RFC_RAISE_ERROR", METHOD="0", MESSAGETYPE="E")
     except (ABAPRuntimeError) as ex:
         assert self.conn.alive == True
         error = get_error(ex)
         assert error["code"] == 4
         assert error["message"][0] == u"Function not supported"
Ejemplo n.º 16
0
    def test_denied_users(self):
        denied_params = params.copy()
        denied_params["user"] = "******"
        try:
            pyrfc.Connection(**denied_params)
        except pyrfc.LogonError as ex:
            error = get_error(ex)

        assert error["code"] == 2
        assert error["key"] == "RFC_LOGON_FAILURE"
        assert error["message"][0] == "Name or password is incorrect (repeat logon)"
Ejemplo n.º 17
0
 def test_ping(self):
     assert self.conn.alive
     self.conn.ping()
     self.conn.close()
     try:
         self.conn.ping()
     except pyrfc.ExternalRuntimeError as ex:
         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"
Ejemplo n.º 18
0
 def test_RFC_RAISE_ERROR_AbapApplicationError_E2(self):
     # '2_E': 'ABAPApplicationError-5-RAISE_EXCEPTION- Number:000-True',
     # cf. ExceptionTest.c (l. 65ff)
     try:
         self.conn.call("RFC_RAISE_ERROR", METHOD="2", MESSAGETYPE="E")
     except ABAPApplicationError as ex:
         assert self.conn.alive == True
         error = get_error(ex)
         assert error["code"] == 5
         assert error["key"] == "RAISE_EXCEPTION"
         assert error["msg_number"] == "000"
Ejemplo n.º 19
0
 def test_RFC_RAISE_ERROR_AbapRuntimeError_A(self):
     # cf. ExceptionTest.c (l. 112ff)
     try:
         self.conn.call("RFC_RAISE_ERROR", MESSAGETYPE="A")
     except (ABAPRuntimeError) as ex:
         assert self.conn.alive == True
         error = get_error(ex)
         assert error["code"] == 4
         assert error["msg_class"] == "SR"
         assert error["msg_type"] == "A"
         assert error["msg_number"] == "006"
         assert error["msg_v1"] == "Method = 0"
Ejemplo n.º 20
0
 def test_RFC_RAISE_ERROR_AbapRuntimeError_X(self):
     # cf. ExceptionTest.c (l. 137ff)
     try:
         self.conn.call("RFC_RAISE_ERROR", MESSAGETYPE="X")
     except (ABAPRuntimeError) as ex:
         assert self.conn.alive == True
         error = get_error(ex)
         assert error["code"] == 4
         assert error["key"] == "MESSAGE_TYPE_X"
         assert error["msg_class"] == "00"
         assert error["msg_type"] == "X"
         assert error["msg_number"] == "341"
         assert error["msg_v1"] == "MESSAGE_TYPE_X"
Ejemplo n.º 21
0
 def test_incomplete_params(self):
     incomplete_params = params.copy()
     for p in ['ashost', 'gwhost', 'mshost']:
         if p in incomplete_params:
             del incomplete_params[p]
     try:
         pyrfc.Connection(**incomplete_params)
     except pyrfc.RFCError as ex:
         error = get_error(ex)
     assert error['code'] == 20
     assert error['key'] == 'RFC_INVALID_PARAMETER'
     assert error['message'][0] in ['Parameter ASHOST, GWHOST, MSHOST or SERVER_PORT is missing.',
                  'Parameter ASHOST, GWHOST or MSHOST is missing.']
Ejemplo n.º 22
0
 def test_RFC_RAISE_ERROR_AbapApplicationError_E1(self):
     # Comment: cf. result_print of the error_test.py
     # '1_E': 'ABAPApplicationError-5-RAISE_EXCEPTION-ID:SR Type:E Number:006 STRING-True',
     # cf. ExceptionTest.c (l. 75ff)
     try:
         self.conn.call("RFC_RAISE_ERROR", METHOD="1", MESSAGETYPE="E")
     except ABAPApplicationError as ex:
         assert self.conn.alive == True
         error = get_error(ex)
         assert error["code"] == 5
         assert error["key"] == "RAISE_EXCEPTION"
         assert error["msg_class"] == u"SR"
         assert error["msg_type"] == "E"
         assert error["msg_number"] == "006"
Ejemplo n.º 23
0
 def test_RFC_RAISE_ERROR_CommunicationError(self):
     # Comment: cf. result_print of the error_test.py
     # '32_E': 'CommunicationError-1-RFC_COMMUNICATION_FAILURE-connection closed without message (CM_NO_DATA_RECEIVED)-True',
     try:
         self.conn.call('RFC_RAISE_ERROR', METHOD='32', MESSAGETYPE='E')
     #except (pyrfc.ABAPRuntimeError) as ex:
     #    error = get_error(ex)
     #    assert error['code'] == 4
     #    assert error['key'] == 'ON:N'
     except (pyrfc.CommunicationError) as ex:
         error = get_error(ex)
         assert error['code'] == 1
         assert error['key'] == 'RFC_COMMUNICATION_FAILURE'
         self.conn.call('RFC_PING')
Ejemplo n.º 24
0
 def test_incomplete_params(self):
     incomplete_params = params.copy()
     for p in ["ashost", "gwhost", "mshost"]:
         if p in incomplete_params:
             del incomplete_params[p]
     try:
         pyrfc.Connection(**incomplete_params)
     except pyrfc.RFCError as ex:
         error = get_error(ex)
     assert error["code"] == 20
     assert error["key"] == "RFC_INVALID_PARAMETER"
     assert error["message"][0] in [
         "Parameter ASHOST, GWHOST, MSHOST or SERVER_PORT is missing.",
         "Parameter ASHOST, GWHOST or MSHOST is missing.",
     ]
Ejemplo n.º 25
0
    def test_RFC_RAISE_ERROR_AbapRuntimeError(self):
        # RFC_RAISE_ERROR ARFC: Raise Different Type of Error Message
        # Comment: cf. result_print of the error_test.py
        # cf. ExceptionTest.c (l. 92ff)
        try:
            self.conn.call('RFC_RAISE_ERROR', METHOD='0', MESSAGETYPE='E')
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error['code'] == 4
            assert error['message'][0] == u'Function not supported'
            self.conn.call('RFC_PING')

        # cf. ExceptionTest.c (l. 112ff)
        try:
            self.conn.call('RFC_RAISE_ERROR', MESSAGETYPE='A')
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error['code'] == 4
            assert error['msg_class'] == 'SR'
            assert error['msg_type'] == 'A'
            assert error['msg_number'] == '006'
            assert error['msg_v1'] == 'Method = 0'
            self.conn.call('RFC_PING')

        # cf. ExceptionTest.c (l. 137ff)
        try:
            self.conn.call('RFC_RAISE_ERROR', MESSAGETYPE='X')
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error['code'] == 4
            assert error['key'] == 'MESSAGE_TYPE_X'
            assert error['msg_class'] == '00'
            assert error['msg_type'] == 'X'
            assert error['msg_number'] == '341'
            assert error['msg_v1'] == 'MESSAGE_TYPE_X'
            self.conn.call('RFC_PING')

        # '36_E': 'ABAPRuntimeError-4-Division by 0 (type I)-Division by 0 (type I)-True''] ==
        try:
            self.conn.call('RFC_RAISE_ERROR', METHOD='36', MESSAGETYPE='E')
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error['code'] == 4
            assert u'Division by 0' in error['message'][0]
            self.conn.call('RFC_PING')

        # '3_E': 'ABAPRuntimeError-3-COMPUTE_INT_ZERODIVIDE-Division by 0 (type I)-True''] ==
        # cf. ExceptionTest.c (l. 164ff)
        try:
            self.conn.call('RFC_RAISE_ERROR', METHOD='3', MESSAGETYPE='E')
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error['code'] == 3
            assert error['key'] == 'COMPUTE_INT_ZERODIVIDE'
            self.conn.call('RFC_PING')

        # '51_E': 'ABAPRuntimeError-3-BLOCKED_COMMIT-A database commit was blocked by the application.-True''] ==
        try:
            self.conn.call('RFC_RAISE_ERROR', METHOD='51', MESSAGETYPE='E')
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error['code'] == 3
            assert error['key'] == 'BLOCKED_COMMIT'
            self.conn.call('RFC_PING')
    def test_RFC_RAISE_ERROR_AbapRuntimeError(self):
        # RFC_RAISE_ERROR ARFC: Raise Different Type of Error Message
        # Comment: cf. result_print of the error_test.py
        # cf. ExceptionTest.c (l. 92ff)
        try:
            self.conn.call("RFC_RAISE_ERROR", METHOD="0", MESSAGETYPE="E")
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error["code"] == 4
            assert error["message"][0] == u"Function not supported"
            self.conn.call("RFC_PING")

        # cf. ExceptionTest.c (l. 112ff)
        try:
            self.conn.call("RFC_RAISE_ERROR", MESSAGETYPE="A")
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error["code"] == 4
            assert error["msg_class"] == "SR"
            assert error["msg_type"] == "A"
            assert error["msg_number"] == "006"
            assert error["msg_v1"] == "Method = 0"
            self.conn.call("RFC_PING")

        # cf. ExceptionTest.c (l. 137ff)
        try:
            self.conn.call("RFC_RAISE_ERROR", MESSAGETYPE="X")
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error["code"] == 4
            assert error["key"] == "MESSAGE_TYPE_X"
            assert error["msg_class"] == "00"
            assert error["msg_type"] == "X"
            assert error["msg_number"] == "341"
            assert error["msg_v1"] == "MESSAGE_TYPE_X"
            self.conn.call("RFC_PING")

        # '36_E': 'ABAPRuntimeError-4-Division by 0 (type I)-Division by 0 (type I)-True''] ==
        try:
            self.conn.call("RFC_RAISE_ERROR", METHOD="36", MESSAGETYPE="E")
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error["code"] == 4
            assert u"Division by 0" in error["message"][0]
            self.conn.call("RFC_PING")

        # '3_E': 'ABAPRuntimeError-3-COMPUTE_INT_ZERODIVIDE-Division by 0 (type I)-True''] ==
        # cf. ExceptionTest.c (l. 164ff)
        try:
            self.conn.call("RFC_RAISE_ERROR", METHOD="3", MESSAGETYPE="E")
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error["code"] == 3
            assert error["key"] == "COMPUTE_INT_ZERODIVIDE"
            self.conn.call("RFC_PING")

        # '51_E': 'ABAPRuntimeError-3-BLOCKED_COMMIT-A database commit was blocked by the application.-True''] ==
        try:
            self.conn.call("RFC_RAISE_ERROR", METHOD="51", MESSAGETYPE="E")
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error["code"] == 3
            assert error["key"] == "BLOCKED_COMMIT"
            self.conn.call("RFC_PING")
Ejemplo n.º 27
0
    def test_RFC_RAISE_ERROR_AbapRuntimeError(self):
        # RFC_RAISE_ERROR ARFC: Raise Different Type of Error Message
        # Comment: cf. result_print of the error_test.py
        # cf. ExceptionTest.c (l. 92ff)
        try:
            self.conn.call("RFC_RAISE_ERROR", METHOD="0", MESSAGETYPE="E")
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error["code"] == 4
            assert error["message"][0] == u"Function not supported"
            self.conn.call("RFC_PING")

        # cf. ExceptionTest.c (l. 112ff)
        try:
            self.conn.call("RFC_RAISE_ERROR", MESSAGETYPE="A")
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error["code"] == 4
            assert error["msg_class"] == "SR"
            assert error["msg_type"] == "A"
            assert error["msg_number"] == "006"
            assert error["msg_v1"] == "Method = 0"
            self.conn.call("RFC_PING")

        # cf. ExceptionTest.c (l. 137ff)
        try:
            self.conn.call("RFC_RAISE_ERROR", MESSAGETYPE="X")
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error["code"] == 4
            assert error["key"] == "MESSAGE_TYPE_X"
            assert error["msg_class"] == "00"
            assert error["msg_type"] == "X"
            assert error["msg_number"] == "341"
            assert error["msg_v1"] == "MESSAGE_TYPE_X"
            self.conn.call("RFC_PING")

        # '36_E': 'ABAPRuntimeError-4-Division by 0 (type I)-Division by 0 (type I)-True''] ==
        try:
            self.conn.call("RFC_RAISE_ERROR", METHOD="36", MESSAGETYPE="E")
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error["code"] == 4
            assert u"Division by 0" in error["message"][0]
            self.conn.call("RFC_PING")

        # '3_E': 'ABAPRuntimeError-3-COMPUTE_INT_ZERODIVIDE-Division by 0 (type I)-True''] ==
        # cf. ExceptionTest.c (l. 164ff)
        try:
            self.conn.call("RFC_RAISE_ERROR", METHOD="3", MESSAGETYPE="E")
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error["code"] == 3
            assert error["key"] == "COMPUTE_INT_ZERODIVIDE"
            self.conn.call("RFC_PING")

        # '51_E': 'ABAPRuntimeError-3-BLOCKED_COMMIT-A database commit was blocked by the application.-True''] ==
        try:
            self.conn.call("RFC_RAISE_ERROR", METHOD="51", MESSAGETYPE="E")
        except (pyrfc.ABAPRuntimeError) as ex:
            error = get_error(ex)
            assert error["code"] == 3
            assert error["key"] == "BLOCKED_COMMIT"
            self.conn.call("RFC_PING")