Skip to content

Commit

Permalink
only clear test tokens (fixes #2110)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLKwong committed Mar 20, 2021
1 parent c1fd8ed commit 9a92d24
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tests/message.bats
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,35 @@ load test-helper
@test "$clinom message slack apitoken (create token)" {
"${clicmd}" config delete xoxp-fake-token
run "${clicmd}" message slack apitoken xoxp-fake-token
assert_success
assert_output --partial 'Your slack apitoken'
"${clicmd}" config delete xoxp-fake-token
}

@test "$clinom message slack apitoken (create invalid token)" {
"${clicmd}" config delete xoxp-fake-token
run "${clicmd}" message slack apitoken fake-token
assert_output --partial 'invalid token'
"${clicmd}" config delete xoxp-fake-token
}

# Needs to 'store' previous tokens and re-add them
@test "$clinom message slack apitoken (no token)" {
"${clicmd}" config clear
run "${clicmd}" message slack apitoken
assert_success
assert_output --partial 'api.slack.com/apps'
}

@test "$clinom message slack apitoken (with token)" {
run "${clicmd}" message slack apitoken xoxp-fake-token
run "${clicmd}" message slack apitoken
assert_success
assert_output --partial 'Your API access token is'
"${clicmd}" config delete xoxp-fake-token
}

@test "$clinom message slack apitoken [bad token]" {
@test "$clinom message slack apitoken (after invalid token)" {
"${clicmd}" config clear
run "${clicmd}" message slack apitoken fake-token
run "${clicmd}" message slack apitoken
assert_output --partial 'Error'
assert_output --partial 'api.slack.com/apps'
"${clicmd}" config delete fake-token
}

0 comments on commit 9a92d24

Please sign in to comment.