Skip to main content

No project description provided

Project description

Краткое описание функционала

  1. Базовая конфигурация для отправки всех api запросов
  2. Логгирование в терминал, allure отчет
  3. Удобное fluent сравнение ожидаемого результата с фактическим результатом
  4. Валидация json схемы

Пример использования

# from reqtestium import allure_logger
from reqtestium import Configuration, HTTPClient, console_logger

config = Configuration(
    base_url="https://petstore.swagger.io",
    # Так же можно создавать свой logger на основе LoggerProtocol
    # from reqtestium.loggers.logger import LoggerProtocol
    loggers=[console_logger],
)
client = HTTPClient(config)


response = client.post(
    "/v2/user",
    json={
        "id": 0,
        "username": "string",
        "firstName": "string",
        "lastName": "string",
        "email": "string",
        "password": "string",
        "phone": "string",
        "userStatus": 0,
    },
)

# Можем проверять конкретные значения или весь ответ
# response.json.should_be_eq()
response.status_code.should_be_eq(200)
response.json.value_with_key("code").should_be_eq(200)
response.json.value_with_key("type").should_be_eq("unknown")

# Можем проверить приходящий json на соответствие схеме.
response.json.schema_should_be_eq(
    {
        "type": "object",
        "properties": {
            "code": {"type": "integer"},
            "type": {"type": "string"},
            "message": {"type": "string"},
        },
        "required": ["code", "type", "message"],
        "additionalProperties": False,
    }
)


# Можем проверить ответ исключив некоторые поля
response.json.without_fields(["type", "message"]).should_be_eq({"code": 200})


# Можем получить оригинальный Response из requests.
print(response.raw_response)


response.json.length.should_be_eq(3)

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

reqtestium-0.10.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

reqtestium-0.10.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file reqtestium-0.10.0.tar.gz.

File metadata

  • Download URL: reqtestium-0.10.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.10 Linux/6.11.0-1012-azure

File hashes

Hashes for reqtestium-0.10.0.tar.gz
Algorithm Hash digest
SHA256 c766494a752c698b5c38e0102b40ef743a24ef8cff304cc7fad5d7e4d1310755
MD5 b842751975b2032a4a82fe2ea34bd6cc
BLAKE2b-256 821d973183a060511d34ecb1f7b4de75b3b471202be05ee21ad8c06089655252

See more details on using hashes here.

File details

Details for the file reqtestium-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: reqtestium-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.10 Linux/6.11.0-1012-azure

File hashes

Hashes for reqtestium-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c719f4a5a99c404b03dd416201efc282d5ec27c39ec2e5ae4231e8370abb20ba
MD5 699e34411d8bd5b3983261c0252f5129
BLAKE2b-256 7bbd05da2fd05697ccf8ea0c1d0eb8550677fc4dc1e36e7efb9cfc05fa2ed27e

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