Skip to main content

Make SOAP services testable from pytest — point at a WSDL, get callable Python.

Project description

soaptest

Make SOAP services testable from pytest. Point it at a WSDL, get callable Python.

30-second example

pip install soaptest
from soaptest import Client

client = Client.from_wsdl(
    "http://www.dataaccess.com/webservicesserver/NumberConversion.wso?WSDL"
)

# Discover what's available
print(client.describe())
# NumberConversionSoap @ http://www.dataaccess.com/webservicesserver/NumberConversion.wso
#   NumberToWords(ubiNum: nonNegativeInteger) -> string
#   NumberToDollars(dNum: decimal) -> string

# Call any operation by name
result = client.NumberToWords(ubiNum=42)
print(result)  # "forty two "

Why

SOAP testing today means SoapUI (a 200 MB GUI) or hand-rolling requests with raw XML. Neither fits naturally into a pytest suite.

soaptest is a thin Pythonic layer on top of zeep. It gives you WSDL discovery (describe()) and operation dispatch (client.OpName(**kwargs)) with zero boilerplate. You write plain pytest test functions; soaptest handles the SOAP.

What it does not do yet: record/replay of responses, fault translation into typed Python exceptions, type stubs for operations, or a pytest fixture plugin. Those are on the Roadmap. v0.1 is intentionally minimal — get the basics right first.

Installation

pip install soaptest

Python 3.9+ is required. zeep, lxml, and httpx are installed automatically.

Usage

Discover operations

from soaptest import Client

client = Client.from_wsdl("https://yourservice.example.com/service?WSDL")
print(client.describe())      # pretty-printed operation list
ops = client.operations       # list of Operation named-tuples

Each Operation has: name, input_signature, output_signature, service, port, port_url.

Call an operation

result = client.SomeOperation(param1="value", param2=123)

__getattr__ dispatches to the underlying zeep service. The return value is whatever zeep returns (usually a zeep.objects.* object or a plain Python scalar). No conversion in v0.1 — that's a future feature.

Unknown operation names raise AttributeError, so hasattr(client, "Op") works.

CLI

soaptest http://www.dataaccess.com/webservicesserver/NumberConversion.wso?WSDL

Prints the operation catalog to stdout and exits.

In pytest

import pytest
from soaptest import Client

WSDL = "https://yourservice.example.com/service?WSDL"

@pytest.fixture(scope="session")
def soap_client():
    return Client.from_wsdl(WSDL)

def test_something(soap_client):
    result = soap_client.SomeOperation(param="value")
    assert result.status == "OK"

Roadmap

v0.1 ships the discovery layer only. Planned for later releases:

  • Fault translation — map SOAP faults to a typed SoapFault Python exception
  • pytest fixture plugin@pytest.fixture helpers and a --wsdl CLI option
  • Type-stub generation — emit .pyi stubs so IDEs can autocomplete operations
  • Record/replay — record live responses to YAML cassettes; replay offline

Contributing

File a bug or feature request in the issue tracker. Pull requests are welcome once an issue is open. For major changes, open an issue first to discuss scope.

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

soaptest-0.1.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

soaptest-0.1.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file soaptest-0.1.0.tar.gz.

File metadata

  • Download URL: soaptest-0.1.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for soaptest-0.1.0.tar.gz
Algorithm Hash digest
SHA256 56b413f4938c9e9707b4ac0f9dc7feaaf1fbccebb95e9fb148b6e4edbfd8b68b
MD5 1f957f39d1e9265f2f525b567242cb8a
BLAKE2b-256 81f0351d99319f779dd58a84d2f983179c98aaefd1c8bfd60a5d203b7c86d700

See more details on using hashes here.

File details

Details for the file soaptest-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: soaptest-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for soaptest-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f4498567482bd302e374ade3d0376f5a7b079792b35f5e4df5ec341e867d3fc
MD5 55fe78a5f7a8de75484f17f48a5c7fec
BLAKE2b-256 c76106a4bcc9f2c0e3d17964894a497e9418e6bad85368b0f388665c3e0ae110

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page