Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle StaticCredentials #63

Merged
merged 2 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/cdpy/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import urllib.parse as urlparse
from os import path

import cdpcli
from cdpcli import VERSION as CDPCLI_VERSION
from cdpcli.client import ClientCreator, Context
from cdpcli.credentials import Credentials
Expand Down
22 changes: 22 additions & 0 deletions tests/test_credentials.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from cdpy.common import StaticCredentials
from cdpy.cdpy import Cdpy
from cdpy.iam import CdpyIam

def test_static_credentials():
ACCESS_KEY_ID = "thekey"
PRIVATE_KEY = "theanswer"

iam = Cdpy(cdp_credentials=StaticCredentials(ACCESS_KEY_ID, PRIVATE_KEY)).iam

assert iam.sdk.cdp_credentials.access_key_id == ACCESS_KEY_ID
assert iam.sdk.cdp_credentials.private_key == PRIVATE_KEY

def test_static_credentials_submodule():
ACCESS_KEY_ID = "thekey"
PRIVATE_KEY = "theanswer"

iam = CdpyIam(cdp_credentials=StaticCredentials(ACCESS_KEY_ID, PRIVATE_KEY))

assert iam.sdk.cdp_credentials.access_key_id == ACCESS_KEY_ID
assert iam.sdk.cdp_credentials.private_key == PRIVATE_KEY