Beispiel #1
0
def test_utclong_rejects_non_string_or_invalid_format():
    UTCLONG = RFC_MATH["UTCLONG"]
    conn = Connection(**connection_info("QM7"))
    try:
        res = conn.call("ZDATATYPES", IV_UTCLONG=1)
    except Exception as ex:
        assert type(ex) is TypeError
        assert ex.args == ("an string is required, received", 1, "of type",
                           type(1), "IV_UTCLONG")

    try:
        res = conn.call("ZDATATYPES", IV_UTCLONG="1")
    except Exception as ex:
        assert type(ex) is ExternalRuntimeError
        assert ex.code == 22
        assert ex.key == "RFC_CONVERSION_FAILURE"
        assert ex.message == "Cannot convert 1 to RFCTYPE_UTCLONG : illegal format"

    conn.close()
    #
    # TypeError:

    # res = conn.call("ZDATATYPES", IV_UTCLONG="1")
    # pyrfc._exception.ExternalRuntimeError: RFC_CONVERSION_FAILURE (rc=22): key=RFC_CONVERSION_FAILURE, message=Cannot convert 1 to RFCTYPE_UTCLONG : illegal format [MSG: class=, type=, number=, v1-4:=;;

    conn.close()
Beispiel #2
0
def test_utclong_accepts_min_max_initial():
    UTCLONG = RFC_MATH["UTCLONG"]
    conn = Connection(**connection_info("QM7"))

    res = conn.call("ZDATATYPES", IV_UTCLONG=UTCLONG["MIN"])
    assert res["EV_UTCLONG"] == UTCLONG["MIN"]

    res = conn.call("ZDATATYPES", IV_UTCLONG=UTCLONG["MAX"])
    assert res["EV_UTCLONG"] == UTCLONG["MAX"]

    res = conn.call("ZDATATYPES", IV_UTCLONG=UTCLONG["INITIAL"])
    assert res["EV_UTCLONG"] == UTCLONG["INITIAL"]

    conn.close()