Repository: Nike-Inc/gimme-aws-creds

Issue:
`force_classic` value is overridden by default when using profile inheritance
<!--- Provide a general summary of the issue in the Title above -->

## Expected Behavior
The following configuration should set `force_classic=False` in the `myprofile` profile
```
[mybase-level1]
client_id = bar
[mybase-level2]
inherits = mybase-level1
aws_appname = baz
force_classic = False
[myprofile]
inherits = mybase-level2
client_id = foo
aws_rolename = myrole
```

When inheriting a profile, if `force_classic = False` is set in the parent profile, the default value `force_classic = True` should not be set in the child profile


## Current Behavior
`force_classic=True` in the `myprofile` profile with the above configuration
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->



Discussion:

Patch:
diff --git a/gimme_aws_creds/config.py b/gimme_aws_creds/config.py
index fe541d3..b5a881b 100644
--- a/gimme_aws_creds/config.py
+++ b/gimme_aws_creds/config.py
@@ -201,23 +201,22 @@ class Config(object):
                 profile_config[key] = True
             elif profile_config[key] == 'False':
                 profile_config[key] = False
-        
-        # Empty string in force_classic should be handled as True - this makes sure that migrating from Classic to OIE is seamless
-        if profile_config.get('force_classic') == '' or profile_config.get('force_classic') is None:
-            profile_config['force_classic'] = True
 
         if "inherits" in profile_config.keys() and include_inherits:
             self.ui.message("Using inherited config: " + profile_config["inherits"])
             if profile_config["inherits"] not in config:
                 raise errors.GimmeAWSCredsError(self.conf_profile + " inherits from " + profile_config["inherits"] + ", but could not find " + profile_config["inherits"])
-            combined_config = {
+            profile_config = {
                 **self._handle_config(config, dict(config[profile_config["inherits"]])),
                 **profile_config,
             }
-            del combined_config["inherits"]
-            return combined_config
-        else:
-            return profile_config
+            del profile_config["inherits"]
+
+        # Empty string in force_classic should be handled as True - this makes sure that migrating from Classic to OIE is seamless
+        if profile_config.get('force_classic') == '' or profile_config.get('force_classic') is None:
+            profile_config['force_classic'] = True
+
+        return profile_config
 
     def get_config_dict(self, include_inherits = True):
         """returns the conf dict from the okta config file"""


Test patch:
diff --git a/tests/test_config.py b/tests/test_config.py
index fc1390f..d327c85 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -122,6 +122,35 @@ aws_rolename = myrole
             "force_classic": True
         })
 
+    def test_read_nested_config_inherited_no_force_classic(self):
+        """Test to make sure getting config works when inherited"""
+        test_ui = MockUserInterface(argv = [
+            "--profile",
+            "myprofile",
+        ])
+        with open(test_ui.HOME + "/.okta_aws_login_config", "w") as config_file:
+            config_file.write("""
+[mybase-level1]
+client_id = bar
+[mybase-level2]
+inherits = mybase-level1
+aws_appname = baz
+force_classic = False
+[myprofile]
+inherits = mybase-level2
+client_id = foo
+aws_rolename = myrole
+""")
+        config = Config(gac_ui=test_ui, create_config=False)
+        config.conf_profile = "myprofile"
+        profile_config = config.get_config_dict()
+        self.assertEqual(profile_config, {
+            "client_id": "foo",
+            "aws_appname": "baz",
+            "aws_rolename": "myrole",
+            "force_classic": False
+        })
+
     def test_fail_if_profile_not_found(self):
         """Test to make sure missing Default fails properly"""
         test_ui = MockUserInterface(argv=[])