diff --git a/gimme_aws_creds/main.py b/gimme_aws_creds/main.py index 42108bf..f28abc6 100644 --- a/gimme_aws_creds/main.py +++ b/gimme_aws_creds/main.py @@ -818,7 +818,7 @@ def get_profile_name(self, cred_profile, include_path, naming_data, resolve_alia account = self._get_account_name(naming_data['account'], role, resolve_alias) role_name = naming_data['role'] path = naming_data['path'] - if include_path == 'True': + if include_path is True: role_name = ''.join([path, role_name]) profile_name = '-'.join([account, role_name]) @@ -827,7 +827,7 @@ def get_profile_name(self, cred_profile, include_path, naming_data, resolve_alia return profile_name def _get_account_name(self, account, role, resolve_alias): - if resolve_alias == "False": + if resolve_alias is False: return account account_alias = self._get_alias_from_friendly_name(role.friendly_account_name) return account_alias or account diff --git a/tests/test_main.py b/tests/test_main.py index f236e7e..f6469b2 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -197,8 +197,8 @@ def test_get_profile_name_accrole_resolve_alias_do_not_include_paths(self): friendly_account_name='Account: my-org-master (123456789012)', friendly_role_name='administrator/administrator') cred_profile = 'acc-role' - resolve_alias = 'True' - include_path = 'False' + resolve_alias = True + include_path = False self.assertEqual(creds.get_profile_name(cred_profile, include_path, naming_data, resolve_alias, role), "my-org-master-administrator") def test_get_profile_accrole_name_do_not_resolve_alias_do_not_include_paths(self): @@ -210,8 +210,8 @@ def test_get_profile_accrole_name_do_not_resolve_alias_do_not_include_paths(self friendly_account_name='Account: my-org-master (123456789012)', friendly_role_name='administrator/administrator') cred_profile = 'acc-role' - resolve_alias = 'False' - include_path = 'False' + resolve_alias = False + include_path = False self.assertEqual(creds.get_profile_name(cred_profile, include_path, naming_data, resolve_alias, role), "123456789012-administrator") @@ -224,8 +224,8 @@ def test_get_profile_accrole_name_do_not_resolve_alias_include_paths(self): friendly_account_name='Account: my-org-master (123456789012)', friendly_role_name='administrator/administrator') cred_profile = 'acc-role' - resolve_alias = 'False' - include_path = 'True' + resolve_alias = False + include_path = True self.assertEqual(creds.get_profile_name(cred_profile, include_path, naming_data, resolve_alias, role), "123456789012-/some/long/extended/path/administrator") @@ -238,8 +238,8 @@ def test_get_profile_name_role(self): friendly_account_name='Account: my-org-master (123456789012)', friendly_role_name='administrator/administrator') cred_profile = 'role' - resolve_alias = 'False' - include_path = 'True' + resolve_alias = False + include_path = True self.assertEqual(creds.get_profile_name(cred_profile, include_path, naming_data, resolve_alias, role), 'administrator') @@ -252,8 +252,8 @@ def test_get_profile_name_account_resolve_alias(self): friendly_account_name='Account: my-org-master (123456789012)', friendly_role_name='administrator/administrator') cred_profile = 'acc' - resolve_alias = 'True' - include_path = 'True' + resolve_alias = True + include_path = True self.assertEqual(creds.get_profile_name(cred_profile, include_path, naming_data, resolve_alias, role), 'my-org-master') @@ -266,8 +266,8 @@ def test_get_profile_name_account_do_not_resolve_alias(self): friendly_account_name='Account: my-org-master (123456789012)', friendly_role_name='administrator/administrator') cred_profile = 'acc' - resolve_alias = 'False' - include_path = 'True' + resolve_alias = False + include_path = True self.assertEqual(creds.get_profile_name(cred_profile, include_path, naming_data, resolve_alias, role), '123456789012') @@ -280,8 +280,8 @@ def test_get_profile_name_default(self): friendly_account_name='Account: my-org-master (123456789012)', friendly_role_name='administrator/administrator') cred_profile = 'default' - resolve_alias = 'False' - include_path = 'True' + resolve_alias = False + include_path = True self.assertEqual(creds.get_profile_name(cred_profile, include_path, naming_data, resolve_alias, role), 'default') @@ -294,7 +294,7 @@ def test_get_profile_name_else(self): friendly_account_name='Account: my-org-master (123456789012)', friendly_role_name='administrator/administrator') cred_profile = 'foo' - resolve_alias = 'False' - include_path = 'True' + resolve_alias = False + include_path = True self.assertEqual(creds.get_profile_name(cred_profile, include_path, naming_data, resolve_alias, role), 'foo')