Skip to content

Commit

Permalink
Add basic test for ElastiCache IAM provider
Browse files Browse the repository at this point in the history
  • Loading branch information
alisaifee committed Dec 6, 2024
1 parent 6a4e40b commit 4054e6e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-r test.txt
-r publishing.txt
-r recipes.txt
black==24.10.0
ruff
isort==5.13.2
Expand Down
3 changes: 3 additions & 0 deletions requirements/recipes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
botocore
cachetools

3 changes: 3 additions & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ pytest-lazy-fixtures
pytest-mock
pytest-reverse
redis

# Recipe test dependencies
moto
Empty file.
14 changes: 14 additions & 0 deletions tests/recipes/credentials/test_elasticache_iam_provider.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from __future__ import annotations

from moto import mock_aws

from coredis.recipes.credentials import ElastiCacheIAMProvider


class TestElastiCacheIAMProvider:
async def test_get_credentials(self):
with mock_aws():
provider = ElastiCacheIAMProvider("test_user", "test_cluster")
user_pass = await provider.get_credentials()
assert user_pass.username == "test_user"
assert "test_cluster/?Action=connect&User=test_user" in user_pass.password

0 comments on commit 4054e6e

Please sign in to comment.