Пример #1
0
def test_prepare_soap_body():
    """Check that the SOAP body is correctly prepared."""
    # No params
    s = SoapMessage("endpoint", "method")
    b = s.prepare_soap_body("a_method", [], None)
    assert b == "<a_method></a_method>"
    # One param
    b = s.prepare_soap_body("a_method", [("one", "1")], None)
    assert b == "<a_method><one>1</one></a_method>"
    # Two params
    b = s.prepare_soap_body("a_method", [("one", "1"), ("two", "2")], None)
    assert b == "<a_method><one>1</one><two>2</two></a_method>"

    # And with a namespace

    b = s.prepare_soap_body("a_method", [("one", "1"), ("two", "2")], "http://a_namespace")
    assert b == "<a_method " 'xmlns="http://a_namespace"><one>1</one><two>2</two' "></a_method>"
Пример #2
0
def test_prepare_soap_body():
    """Check that the SOAP body is correctly prepared."""
    # No params
    s = SoapMessage("endpoint", "method")
    b = s.prepare_soap_body("a_method", [], None)
    assert b == "<a_method></a_method>"
    # One param
    b = s.prepare_soap_body("a_method", [("one", "1")], None)
    assert b == "<a_method><one>1</one></a_method>"
    # Two params
    b = s.prepare_soap_body("a_method", [("one", "1"), ("two", "2")], None)
    assert b == "<a_method><one>1</one><two>2</two></a_method>"

    # And with a namespace

    b = s.prepare_soap_body("a_method", [("one", "1"), ("two", "2")],
                            "http://a_namespace")
    assert (b == "<a_method "
            'xmlns="http://a_namespace"><one>1</one><two>2</two'
            "></a_method>")
Пример #3
0
def test_prepare_soap_body():
    """ Check that the SOAP body is correctly prepared """
    # No params
    s = SoapMessage('endpoint', 'method')
    b = s.prepare_soap_body('a_method', [], None)
    assert b == "<a_method></a_method>"
    # One param
    b = s.prepare_soap_body('a_method', [('one', '1')], None)
    assert b == "<a_method><one>1</one></a_method>"
    # Two params
    b = s.prepare_soap_body('a_method', [
        ('one', '1'), ('two', '2')
    ], None)
    assert b == "<a_method><one>1</one><two>2</two></a_method>"

    # And with a namespace

    b = s.prepare_soap_body('a_method', [('one', '1'),
                                         ('two', '2')], "http://a_namespace")
    assert b == "<a_method " \
                'xmlns="http://a_namespace"><one>1</one><two>2</two' \
                '></a_method>'
Пример #4
0
def test_prepare_soap_body():
    """Check that the SOAP body is correctly prepared."""
    # No params
    s = SoapMessage('endpoint', 'method')
    b = s.prepare_soap_body('a_method', [], None)
    assert b == "<a_method></a_method>"
    # One param
    b = s.prepare_soap_body('a_method', [('one', '1')], None)
    assert b == "<a_method><one>1</one></a_method>"
    # Two params
    b = s.prepare_soap_body('a_method', [
        ('one', '1'), ('two', '2')
    ], None)
    assert b == "<a_method><one>1</one><two>2</two></a_method>"

    # And with a namespace

    b = s.prepare_soap_body('a_method', [('one', '1'),
                                         ('two', '2')], "http://a_namespace")
    assert b == "<a_method " \
                'xmlns="http://a_namespace"><one>1</one><two>2</two' \
                '></a_method>'