RiotGames / key-conjurer

Temporary Credential Service
https://technology.riotgames.com/news/key-conjurer-our-policy-least-privilege
Apache License 2.0
167 stars 33 forks source link

Refactor tests cases #80

Closed fnickels closed 1 year ago

fnickels commented 2 years ago

also updated some comments

fnickels commented 2 years ago

@trinitroglycerin made several adjustments per your feedback and commented on what I am doing with stringChecks(). Let me know what you think and what other refinements I should consider.

punmechanic commented 1 year ago

I'm closing this because it's old and it appears that one of the added tests, TestHelpCommand, no longer passes (see below for more info).

KeyConjurer is undergoing a lot of changes as part of #98, but please feel free to re-open a new PR with changes similar to this after the changes have landed if you want - we will merge it much faster this time :)

dan@praxidike:~/Code/key-conjurer/cli$ go test
--- FAIL: TestHelpCommand (0.00s)
    root_test.go:132: String being checked:
        ===========
        Key Conjurer retrieves temporary credentials from the Key Conjurer API.

        To get started run the following commands:
          keyconjurer login # You will get prompted for your AD credentials
          keyconjurer accounts
          keyconjurer get <accountName>

        Usage:
          keyconjurer [flags]
          keyconjurer [command]

        Available Commands:
          accounts           Prints the list of accounts you have access to.
          alias              Give an account a nickname.
          get                Retrieves temporary AWS API credentials.
          help               Help about any command
          identity-providers List identity providers you may use.
          login              Authenticate with KeyConjurer.
          roles              List all the roles that you can assume when using `keyconjurer get`.
          set                Sets config values.
          switch             Switch from the current AWS account into the one with the given Account ID.
          unalias            Remove alias from account.
          upgrade            Downloads the latest version of keyconjurer.

        Flags:
          -h, --help                         help for keyconjurer
              --host string                  The host of the KeyConjurer API
              --keyconjurer-rc-path string   path to .keyconjurerrc file (default "~/.keyconjurerrc")
          -1, --oneline-version              version for keyconjurer (single line format)
              --quiet                        tells the CLI to be quiet; stdout will not contain human-readable informational messages
          -s, --short-version                version for keyconjurer (short format)

        Use "keyconjurer [command] --help" for more information about a command.

        ===========
    root_test.go:132: Content missing that was expected:
    root_test.go:132: Should have found (Francis) in the output above
    root_test.go:132: Should have found (Nickels) in the output above
    root_test.go:132: Content found that was not expected:
    root_test.go:132: Should NOT have found (host) in the output above
FAIL
exit status 1
FAIL    github.com/riotgames/key-conjurer/cli   0.007s