-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BB-242] _load_configs_for_credentials test (#245)
* _load_configs_for_credentials test * coveralls integration * fix indentation * trying xml format * skip docker image for unit tests * missing quote
- Loading branch information
Showing
6 changed files
with
73 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ leverage.egg-info | |
**/__pycache__* | ||
.pytest_cache | ||
coverage | ||
coverage.xml | ||
.coverage | ||
|
||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
from .run import run | ||
from .project import project | ||
from .terraform import terraform | ||
from .credentials import credentials | ||
from .tfautomv import tfautomv | ||
from .kubectl import kubectl | ||
from .shell import shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
from unittest import mock | ||
from unittest.mock import Mock | ||
|
||
from leverage.modules.credentials import _load_configs_for_credentials | ||
|
||
|
||
@mock.patch( | ||
"leverage.modules.credentials._load_project_yaml", | ||
Mock( | ||
return_value={ | ||
"short_name": "test", | ||
"region": "us-test-1", | ||
"organization": { | ||
"accounts": [ | ||
{"name": "acc2"}, | ||
] | ||
}, | ||
} | ||
), | ||
) | ||
@mock.patch( | ||
"leverage.modules.credentials.AWSCLI", | ||
Mock( | ||
env_conf={ | ||
"PROJECT": "test", | ||
"MFA_ENABLED": "true", | ||
}, | ||
paths=Mock( | ||
common_conf={ | ||
"project_long": "test-prjt", | ||
"region_secondary": "us-test-2", | ||
"accounts": { | ||
"acc1": { | ||
"email": "[email protected]", | ||
"id": "123456", | ||
} | ||
}, | ||
}, | ||
), | ||
), | ||
) | ||
def test_load_configs_for_credentials(with_click_context): | ||
assert _load_configs_for_credentials() == { | ||
"mfa_enabled": "true", | ||
"organization": { | ||
"accounts": [ | ||
{ | ||
"email": "[email protected]", | ||
"id": "123456", | ||
"name": "acc1", | ||
}, | ||
{ | ||
"name": "acc2", | ||
}, | ||
] | ||
}, | ||
"primary_region": "us-test-1", | ||
"project_name": "test-prjt", | ||
"secondary_region": "us-test-2", | ||
"short_name": "test", | ||
} |