Skip to content

Commit 3ca9a72

Browse files
authored
Handle StaticCredentials (#63)
* Add core Cdpy test for StaticCredentials * Add submodule test for StaticCredentials Signed-off-by: Webster Mudge <[email protected]>
1 parent ac88be1 commit 3ca9a72

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/cdpy/common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import urllib.parse as urlparse
2020
from os import path
2121

22-
import cdpcli
2322
from cdpcli import VERSION as CDPCLI_VERSION
2423
from cdpcli.client import ClientCreator, Context
2524
from cdpcli.credentials import Credentials

tests/test_credentials.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from cdpy.common import StaticCredentials
2+
from cdpy.cdpy import Cdpy
3+
from cdpy.iam import CdpyIam
4+
5+
def test_static_credentials():
6+
ACCESS_KEY_ID = "thekey"
7+
PRIVATE_KEY = "theanswer"
8+
9+
iam = Cdpy(cdp_credentials=StaticCredentials(ACCESS_KEY_ID, PRIVATE_KEY)).iam
10+
11+
assert iam.sdk.cdp_credentials.access_key_id == ACCESS_KEY_ID
12+
assert iam.sdk.cdp_credentials.private_key == PRIVATE_KEY
13+
14+
def test_static_credentials_submodule():
15+
ACCESS_KEY_ID = "thekey"
16+
PRIVATE_KEY = "theanswer"
17+
18+
iam = CdpyIam(cdp_credentials=StaticCredentials(ACCESS_KEY_ID, PRIVATE_KEY))
19+
20+
assert iam.sdk.cdp_credentials.access_key_id == ACCESS_KEY_ID
21+
assert iam.sdk.cdp_credentials.private_key == PRIVATE_KEY
22+

0 commit comments

Comments
 (0)