Exemplo n.º 1
0
def test_prepare_headers():
    """Check http_headers are correctly prepared."""
    s = SoapMessage('endpoint', 'method')
    h = s.prepare_headers({'test1': 'one', 'test2': 'two'}, None)
    assert h == {'Content-Type': 'text/xml; charset="utf-8"',
                 'test2': 'two', 'test1': 'one'}
    h = s.prepare_headers(http_headers={'test1': 'one', 'test2': 'two'},
                          soap_action='soapaction')
    assert h == {'Content-Type': 'text/xml; charset="utf-8"',
                 'test2': 'two', 'test1': 'one',
                 'SOAPACTION': '"soapaction"'}
Exemplo n.º 2
0
def test_prepare_headers():
    """Check http_headers are correctly prepared."""
    s = SoapMessage("endpoint", "method")
    h = s.prepare_headers({"test1": "one", "test2": "two"}, None)
    assert h == {
        "Content-Type": 'text/xml; charset="utf-8"',
        "test2": "two",
        "test1": "one",
    }
    h = s.prepare_headers(http_headers={
        "test1": "one",
        "test2": "two"
    },
                          soap_action="soapaction")
    assert h == {
        "Content-Type": 'text/xml; charset="utf-8"',
        "test2": "two",
        "test1": "one",
        "SOAPACTION": '"soapaction"',
    }