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.2.tar.gz (8.1 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.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: soaptest-0.1.2.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for soaptest-0.1.2.tar.gz
Algorithm Hash digest
SHA256 69f4d10da42efa95751a7d7720c9933bb5903f1301d3fc9c7b03788498adf019
MD5 e0a5d83143815717d3b52eb492630787
BLAKE2b-256 d200a311a1936494eeda8feebb522d7155d538e32d41d7c252a8746140bb3e92

See more details on using hashes here.

Provenance

The following attestation bundles were made for soaptest-0.1.2.tar.gz:

Publisher: release.yml on jaey8den/soaptest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: soaptest-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for soaptest-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b0bc4b7dfde1e7565ac1eed5076cb2f80ea20223a742603654bf465fdfe6852f
MD5 ed06369eb9cd297f26a1782ef72104fa
BLAKE2b-256 781d22dd7ff331e3f63228dbb46f18d225bad4bfe56ef893cd85499180f14ecb

See more details on using hashes here.

Provenance

The following attestation bundles were made for soaptest-0.1.2-py3-none-any.whl:

Publisher: release.yml on jaey8den/soaptest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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