cevoaustralia / aws-google-auth

Provides AWS STS credentials based on Google Apps SAML SSO auth (what a jumble!)
MIT License
537 stars 181 forks source link

Unit Tests will always fail because 'ask_role' is defaulted to 'False' #100

Closed paulieborg closed 6 years ago

paulieborg commented 6 years ago

I am trying to get UnitTests to work:

python -m unittest discover . "test*.py"

I get 4 failures and they all seem to be for the same underlying reason.

Am I right that this clever coalesce function # Ask Role (Option priority = ARGS, ENV_VAR, DEFAULT)

        config.ask_role = bool(coalesce(
        args.ask_role,
        os.getenv('AWS_ASK_ROLE'),
        config.ask_role))

Will always return 'False' as the value in args.ask_role is not None it is set to False by Default in configuration.py _In Class Configuration_

        # Set up some defaults. These can be overridden as fit.
        self.ask_role = False
        ...
        ...

In this case, the value can never be overridden by environment??

(This also maybe flags the importance of Unit Tests in Travis Build ....) Happy to be shot down!

paulieborg commented 6 years ago

If I'm right, I'm also happy to fix & submit PR. Just wanted to check I'm on the right track and we should also therefore, discuss alternatives of resolving the config ...

paulieborg commented 6 years ago

I'll withdraw this. The unittests can be run using the nosetests module The decorator @nottest is skipping this.

stevemac007 commented 6 years ago

This is a good point @paulieborg - These tests were written as part of some earlier work and I noticed exactly what your opening comments mentioned.

I left these tests in so that this discussion could review if there is a better way to structure the codebase so these are not invalid.