AioMoto Fixtures
asyncio fixtures
AWS test fixtures
This test suite uses a large suite of moto mocks for the AWS batch infrastructure. These infrastructure mocks are derived from the moto test suite for testing the batch client. The test infrastructure should be used according to the moto license. That license overrides any global license applied to my aio_aws project.
.. seealso::
- https://github.com/spulec/moto/pull/1197/files
- https://github.com/spulec/moto/blob/master/tests/test_batch/test_batch.py
aio_aws_batch_client(aio_aws_session, aio_aws_batch_server)
async
AWS Async Client for AioMotoService("batch")
Source code in pytest_aiomoto/aiomoto_fixtures.py
213 214 215 216 217 218 219 220 221 222 |
|
aio_aws_batch_clients(aio_aws_batch_client, aio_aws_ec2_client, aio_aws_ecs_client, aio_aws_iam_client, aio_aws_logs_client, aws_region)
async
Async Clients for AWS Batch Infrastructure
Source code in pytest_aiomoto/aiomoto_fixtures.py
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
|
aio_aws_batch_infrastructure(aio_aws_batch_clients, compute_env_name, job_queue_name, job_definition_name, iam_role_name)
async
AWS Batch Infrastructure with Async Clients
Source code in pytest_aiomoto/aiomoto_fixtures.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
|
aio_aws_batch_server()
async
AioMotoService("batch")
Source code in pytest_aiomoto/aiomoto_fixtures.py
44 45 46 47 48 49 50 51 52 |
|
aio_aws_cloudformation_server()
async
AioMotoService("cloudformation")
Source code in pytest_aiomoto/aiomoto_fixtures.py
55 56 57 58 59 60 61 62 63 |
|
aio_aws_dynamodb2_server()
async
AioMotoService("dynamodb2")
Source code in pytest_aiomoto/aiomoto_fixtures.py
99 100 101 102 103 104 105 106 107 |
|
aio_aws_ec2_client(aio_aws_session, aio_aws_ec2_server)
async
AWS Async Client for AioMotoService("ec2")
Source code in pytest_aiomoto/aiomoto_fixtures.py
225 226 227 228 229 230 231 232 233 234 |
|
aio_aws_ec2_server()
async
AioMotoService("ec2")
Source code in pytest_aiomoto/aiomoto_fixtures.py
66 67 68 69 70 71 72 73 74 |
|
aio_aws_ecs_client(aio_aws_session, aio_aws_ecs_server)
async
AWS Async Client for AioMotoService("ecs")
Source code in pytest_aiomoto/aiomoto_fixtures.py
237 238 239 240 241 242 243 244 245 246 |
|
aio_aws_ecs_server()
async
AioMotoService("ecs")
Source code in pytest_aiomoto/aiomoto_fixtures.py
77 78 79 80 81 82 83 84 85 |
|
aio_aws_iam_client(aio_aws_session, aio_aws_iam_server)
async
AWS Async Client for AioMotoService("iam")
Source code in pytest_aiomoto/aiomoto_fixtures.py
249 250 251 252 253 254 255 256 257 258 259 |
|
aio_aws_iam_server()
async
AioMotoService("iam")
Source code in pytest_aiomoto/aiomoto_fixtures.py
88 89 90 91 92 93 94 95 96 |
|
aio_aws_lambda_client(aio_aws_session, aio_aws_lambda_server)
async
AWS Async Client for AioMotoService("lambda")
Source code in pytest_aiomoto/aiomoto_fixtures.py
262 263 264 265 266 267 268 269 270 271 |
|
aio_aws_lambda_server()
async
AioMotoService("lambda")
Source code in pytest_aiomoto/aiomoto_fixtures.py
110 111 112 113 114 115 116 117 118 |
|
aio_aws_logs_client(aio_aws_session, aio_aws_logs_server)
async
AWS Async Client for AioMotoService("logs")
Source code in pytest_aiomoto/aiomoto_fixtures.py
274 275 276 277 278 279 280 281 282 283 |
|
aio_aws_logs_server()
async
AioMotoService("logs")
Source code in pytest_aiomoto/aiomoto_fixtures.py
121 122 123 124 125 126 127 128 129 130 |
|
aio_aws_s3_client(aio_aws_session, aio_aws_s3_server, mocker)
async
AWS Async Client for AioMotoService("s3")
Source code in pytest_aiomoto/aiomoto_fixtures.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
|
aio_aws_s3_server()
async
AioMotoService("s3")
Source code in pytest_aiomoto/aiomoto_fixtures.py
133 134 135 136 137 138 139 140 141 |
|
aio_aws_session(aws_credentials, aws_region, event_loop)
An AioSession configured with credentials for moto services
Source code in pytest_aiomoto/aiomoto_fixtures.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
aio_aws_sns_server()
async
AioMotoService("sns")
Source code in pytest_aiomoto/aiomoto_fixtures.py
144 145 146 147 148 149 150 151 152 |
|
aio_aws_sqs_server()
async
AioMotoService("sqs")
Source code in pytest_aiomoto/aiomoto_fixtures.py
155 156 157 158 159 160 161 162 163 |
|
Test Asyncio AWS Lambda
aws_lambda_func(aws_lambda_zip, lambda_iam_role, aws_lambda_python_runtime, aio_aws_lambda_client)
async
Create an AWS Lambda function and return the function name 'lambda_dev'.
Source code in pytest_aiomoto/aiomoto_lambda.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
aws_lambda_python_runtime()
The python3.8 runtime for AWS Lambda.
Source code in pytest_aiomoto/aiomoto_lambda.py
39 40 41 42 43 44 |
|
aws_lambda_zip()
A ZIP archive to create an AWS Lambda function
from the :py:func:aws_lambda_src
function.
Source code in pytest_aiomoto/aiomoto_lambda.py
30 31 32 33 34 35 36 |
|
lambda_iam_role(aio_aws_iam_client)
async
An IAM role to create an AWS Lambda function
Source code in pytest_aiomoto/aiomoto_lambda.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
aio_s3_bucket_name(aio_s3_uuid)
A valid S3 bucket name :return: str for the bucket component of 's3://{bucket}/{key}'
Source code in pytest_aiomoto/aiomoto_s3.py
29 30 31 32 33 34 |
|
aio_s3_key(aio_s3_key_path, aio_s3_key_file)
A valid S3 key composed of a key_path and a key_file The key component of 's3://{bucket}/{key}' that is composed of '{key_path}/{key_file}'; the key does not begin or end with any delimiters (e.g. '/') :return: str for the key component of 's3://{bucket}/{key}'
Source code in pytest_aiomoto/aiomoto_s3.py
57 58 59 60 61 62 63 64 |
|
aio_s3_key_file()
A valid S3 key name that is also a file name The key component of 's3://{bucket}/{key}' that is composed of '{key_file}'; the key does not begin or end with any delimiters (e.g. '/') :return: str for the key component of 's3://{bucket}/{key}'
Source code in pytest_aiomoto/aiomoto_s3.py
47 48 49 50 51 52 53 54 |
|
aio_s3_key_path()
A valid S3 key name that is not a file name, it's like a directory The key component of 's3://{bucket}/{key}' that is composed of '{key_path}'; the key does not begin or end with any delimiters (e.g. '/') :return: str for the key component of 's3://{bucket}/{key}'
Source code in pytest_aiomoto/aiomoto_s3.py
37 38 39 40 41 42 43 44 |
|
aio_s3_object_text()
s3 object data: 's3 test object text '
Source code in pytest_aiomoto/aiomoto_s3.py
75 76 77 78 |
|
aio_s3_object_uri(aio_s3_bucket_name, aio_s3_key, aio_s3_uri, aio_s3_object_text, aio_s3_bucket, aio_aws_s3_client)
async
s3 object data is PUT to the aio_s3_uri
Source code in pytest_aiomoto/aiomoto_s3.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
|
aio_s3_uri(aio_s3_bucket_name, aio_s3_key)
A valid S3 URI comprised of 's3://{bucket}/{key}' :return: str
Source code in pytest_aiomoto/aiomoto_s3.py
67 68 69 70 71 72 |
|
aio_s3_uuid()
A UUID for S3 artifacts
Source code in pytest_aiomoto/aiomoto_s3.py
23 24 25 26 |
|
aio_s3fs(aio_aws_session, aio_aws_s3_server, mocker, monkeypatch)
The aio_s3fs
fixture mocks generation of any aiobotocore.client.S3
object
so that it calls a localhost server provided by an asyncio version of the moto-server.
The aio_s3fs
fixture is simply a context to apply the mock, it is not intended to be a
replacement for s3fs
. Just add the aio_s3fs
fixture to a test function and then use
s3fs
as normal.
Source code in pytest_aiomoto/aiomoto_s3fs.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|