🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

awssert

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awssert

Declarative assertions for AWS

1.0.0
Source
PyPI
Maintainers
1

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 ServiceResource ObjectAWSsert Supported
CloudFormationEvent:x:
Stack:x:
StackResource:x:
StackResourceSummary:x:
CloudWatchAlarm:x:
Metric:x:
DynamoDBTable:white_check_mark:
EC2ClassicAddress:x:
DhcpOptions:x:
Image:x:
Instance:x:
InternetGateway:x:
KeyPair:x:
KeyPairInfo:x:
NetworkAcl:x:
NetworkInterface:x:
NetworkInterfaceAssociation:x:
PlacementGroup:x:
Route:x:
RouteTable:x:
RouteTableAssociation:x:
SecurityGroup:x:
Snapshot:x:
Subnet:x:
Tag:x:
Volume:x:
Vpc:x:
VpcPeeringConnection:x:
VpcAddress:x:
GlacierAccount:x:
Archive:x:
Job:x:
MultipartUpload:x:
Notification:x:
Vault:x:
IAMAccessKey:x:
AccessKeyPair:x:
AccountPasswordPolicy:x:
AccountSummary:x:
AssumeRolePolicy:x:
CurrentUser:x:
Group:white_check_mark:
GroupPolicy:x:
InstanceProfile:x:
LoginProfile:x:
MfaDevice:x:
Policy:white_check_mark:
PolicyVersion:x:
Role:white_check_mark:
RolePolicy:x:
SamlProvider:x:
ServerCertificate:x:
SigningCertificate:x:
User:white_check_mark:
UserPolicy:x:
VirtualMfaDevice:x:
OpsWorksLayer:x:
Stack:x:
StackSummary:x:
S3Bucket:white_check_mark:
BucketAcl:x:
BucketCors:x:
BucketLifecycle:x:
BucketLifecycleConfiguration:x:
BucketLogging:x:
BucketNotification:x:
BucketPolicy:x:
BucketRequestPayment:x:
BucketTagging:x:
BucketVersioning:x:
BucketWebsite:x:
MultipartUpload:x:
MultipartUploadPart:x:
Object:x:
ObjectAcl:x:
ObjectSummary:x:
ObjectVersion:x:
SNSPlatformApplication:x:
PlatformEndpoint:x:
Subscription:x:
Topic:white_check_mark:
SQSMessage:x:
Queue:x:

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

Keywords

aws

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts