Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Add e2e patch tests for unauthorized commands #581

Merged
merged 3 commits into from Mar 21, 2019
Merged

Conversation

MeBrei
Copy link
Contributor

@MeBrei MeBrei commented Mar 20, 2019

No description provided.

@MeBrei MeBrei requested a review from jameshaydon March 20, 2019 14:47
step "rad patch reject fails (contributer)"
_ <- runTestCommand "rad-key" ["create", "--force"]
rejectOutput <- runTestCommandForError "rad-patch" ["reject", "0"]
assertContains rejectOutput "Are you authorized to do so?"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be less brittle to check for "error". Unrelated to this PR, but I note that in error-messages.rad, some messages are prefixed with error:, some with Error: and some not prefixed at all. Maybe this should be made consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I can create another issue for that

-- | Like 'runTestCommand'' but expects the command to return an error.
--
-- If the command exits with a non-zero exit code, an exception is thrown.
-- Otherwise stdout of the error is returned.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-- Otherwise stdout of the error is returned.
-- Otherwise stdout of the command is returned.

test/e2e/Test/E2ESupport.hs Outdated Show resolved Hide resolved
let commandLine = bin <> " " <> unwords argsString
in liftIO $ HUnit.assertFailure $
"Command " <> commandLine <> " succeeded,\n"
<> "but was expected to fail."

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think printing stdout and stderr would be helpful here, too.

@MeBrei MeBrei merged commit a505c81 into master Mar 21, 2019
@MeBrei MeBrei deleted the f/more-patch-tests branch March 21, 2019 12:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants