Skip to main content

HTTP plugin for Tavern with AWS4Auth

Project description

image image image

Tavern AWS plugin

This is a Tavern plugin to add AWS Sig4 authentication headers to your calls using requests-aws4auth .

This plugin reuses original requests-based REST plugin from Tavern, so it works with non-AWS endpoints too.

Usage

Install

Regular install via pip: pip install tavern-aws

Tavern integration

Set option tavern_http_backend to aws.

You can do it via project options:

[tool.pytest.ini_options]
tavern_http_backend = aws

or via conftest.py:

def pytest_configure(config: pytest.Config):
    config.option.tavern_http_backend = "aws"

Change it back to requests to use regular Tavern's REST plugin.

Tests

Supply AWS credentials as text fields:

test_name: Call endpoint with IAM auth

aws:
    access_key: xxxxxxxxxxxxxxxxxxxx
    secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    service: appsync
    region: us-east-1

stages:
  - name: first stage

Or from boto3 session object via pytest fixtures:

import boto3
import botocore.credentials
import pytest

@pytest.fixture(scope="session", autouse=True)
def boto_session() -> boto3.Session:
    return boto3.Session()

@pytest.fixture(scope="session", autouse=True)
def boto_credentials(boto_session: boto3.Session) -> botocore.credentials.Credentials:
    return boto_session.get_credentials()
test_name: Call endpoint with IAM auth

aws:
    access_key: "{boto_credentials.access_key}"
    secret_key: "{boto_credentials.secret_key}"
    service: appsync
    region: us-east-1
    session_token: "{boto_credentials.token}"

stages:
  - name: first stage

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

tavern_aws-1.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

tavern_aws-1.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file tavern_aws-1.1.0.tar.gz.

File metadata

  • Download URL: tavern_aws-1.1.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Linux/6.11.0-1015-azure

File hashes

Hashes for tavern_aws-1.1.0.tar.gz
Algorithm Hash digest
SHA256 220c6a5b821b106bbaba483caf850bfae114a54be909498ce70a8309d61ed185
MD5 3a8699dd6144ed8c69f0fbf475bf5d1d
BLAKE2b-256 6ebfd2b6d7ceed6fd25b020621455e6646efeecd40768d79be541b571a597d11

See more details on using hashes here.

File details

Details for the file tavern_aws-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: tavern_aws-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Linux/6.11.0-1015-azure

File hashes

Hashes for tavern_aws-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75f5566af801d302fcfcdf187a800b8cd0e67ef33d6a7676ac5b6f8bde98080f
MD5 df2bd0051145f73109b0bdb9d36b796e
BLAKE2b-256 12ad82e2056e580c5f328b6682db643f3d43e37c6ecdb60ce81bd7d00189a94a

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