Skip to main content

AWSsert

GitHub Workflow Status PyPI PyPI - Python Version Code style: black

AWSsert is a Python library providing declarative assertions about AWS resources to your tests.

Installation

Use the package manager pip to install AWSsert.

pip install awssert

Usage

Installing the package will make AWSserts extra assertions available to all of your tests. Assertions are attached directly to boto3 resource objects, allowing you to write clean and declarative tests:

import boto3

def test_bucket_contains_object():
   bucket = boto3.resource("s3").Bucket("foo")
   assert bucket.should_not.contain("bar")
   bucket.put_object(Key="bar", Body=b"123")
   assert bucket.should.contain("bar")

AWSsert also works in tandem with moto, enabling the same level of clarity to be applied on mock infrastructure:

import boto3
from moto import mock_s3

@mock_s3
def test_mock_bucket_contains_object():
   bucket = boto3.resource("s3").Bucket("foo")
   assert bucket.should_not.contain("bar")
   bucket.put_object(Key="bar", Body=b"123")
   assert bucket.should.contain("bar")

Progress

AWS Service Resource Object AWSsert Supported
CloudFormation Event ❌
Stack ❌
StackResource ❌
StackResourceSummary ❌
CloudWatch Alarm ❌
Metric ❌
DynamoDB Table ✅
EC2 ClassicAddress ❌
DhcpOptions ❌
Image ❌
Instance ❌
InternetGateway ❌
KeyPair ❌
KeyPairInfo ❌
NetworkAcl ❌
NetworkInterface ❌
NetworkInterfaceAssociation ❌
PlacementGroup ❌
Route ❌
RouteTable ❌
RouteTableAssociation ❌
SecurityGroup ❌
Snapshot ❌
Subnet ❌
Tag ❌
Volume ❌
Vpc ❌
VpcPeeringConnection ❌
VpcAddress ❌
Glacier Account ❌
Archive ❌
Job ❌
MultipartUpload ❌
Notification ❌
Vault ❌
IAM AccessKey ❌
AccessKeyPair ❌
AccountPasswordPolicy ❌
AccountSummary ❌
AssumeRolePolicy ❌
CurrentUser ❌
Group ✅
GroupPolicy ❌
InstanceProfile ❌
LoginProfile ❌
MfaDevice ❌
Policy ✅
PolicyVersion ❌
Role ✅
RolePolicy ❌
SamlProvider ❌
ServerCertificate ❌
SigningCertificate ❌
User ✅
UserPolicy ❌
VirtualMfaDevice ❌
OpsWorks Layer ❌
Stack ❌
StackSummary ❌
S3 Bucket ✅
BucketAcl ❌
BucketCors ❌
BucketLifecycle ❌
BucketLifecycleConfiguration ❌
BucketLogging ❌
BucketNotification ❌
BucketPolicy ❌
BucketRequestPayment ❌
BucketTagging ❌
BucketVersioning ❌
BucketWebsite ❌
MultipartUpload ❌
MultipartUploadPart ❌
Object ❌
ObjectAcl ❌
ObjectSummary ❌
ObjectVersion ❌
SNS PlatformApplication ❌
PlatformEndpoint ❌
Subscription ❌
Topic ✅
SQS Message ❌
Queue ❌

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

A full contribution guide and code of conduct are supplied with the repository. In essence, update the unit tests and changelog, and treat fellow users with respect!

License

Apache Software License 2.0

Metadata

Release files for awssert 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for awssert 1.0.0
File Size Uploaded
awssert-1.0.0.tar.gz 18.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for awssert 1.0.0
File Interpreter ABI Platform
awssert-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.2 kB

Release files / awssert-1.0.0.tar.gz

Download URL awssert-1.0.0.tar.gz
Size 18.9 kB
Tags Source
SHA-256 checksum
How to use checksums
261bab609a36bef04096c8ca777159e5b28e53c2473f215b406dc2444e0c9102
BLAKE2b-256 checksum
How to use checksums
bff9b2fcde87a407816720f5124aec75bac6e53b3d0b36df6a0ff4a15499ca7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / awssert-1.0.0-py3-none-any.whl

Download URL awssert-1.0.0-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0057038c324fb3f189265f10637a7a0a28915796f100db97f5ab54fff5ff8ef
BLAKE2b-256 checksum
How to use checksums
2506948ffabfc69e04bf58ecb395ed83e01c693ca92d3b7542c153a5703b860a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.0.13

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page