Skip to content

Commit

Permalink
some new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Gartland committed Feb 5, 2024
1 parent c196143 commit 0d05e93
Showing 1 changed file with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions test/bats/contract/accounts.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,45 @@ load '../node_modules/bats-assert/load'
@test "list accounts" {
run ${EXE} list-accounts
assert_success
assert_output --partial "Nickname: \"env\""
assert_output --partial "Configured via: CONNECT_SERVER environment variable"
assert_output --partial "Authentication: Connect API key"
assert_line -p "Nickname: \"env\""
assert_line -p "Configured via: CONNECT_SERVER environment variable"
assert_line -p "Authentication: Connect API key"
}

# test-account should pass with env
@test "test accounts" {
run ${EXE} test-account env
assert_success
assert_output --partial "Name: Administrator Smith"
assert_output --partial "Username: admin"
assert_output --partial "Email: [email protected]"
assert_line -p "Name: Administrator Smith"
assert_line -p "Username: admin"
assert_line -p "Email: [email protected]"
}

@test "list accounts with no account" {
unset CONNECT_SERVER
run ${EXE} list-accounts
assert_success
assert_line "No accounts found. Use rsconnect or rsconnect-python to register an account."
}

@test "list accounts no API KEY" {
unset CONNECT_API_KEY
run ${EXE} list-accounts
assert_success
assert_line -p "Authentication: No saved credentials"
}

# tempoarily add the server with rsconnect-python
@test "add the server and use it" {
run rsconnect add -n ci-test -s $CONNECT_SERVER -k $CONNECT_API_KEY
unset CONNECT_SERVER
unset CONNECT_API_KEY
run ${EXE} list-accounts
assert_line -p "Nickname: \"ci-test\""
assert_line -p "Configured via: rsconnect-python"
assert_line -p "Authentication: Connect API key"
}

teardown() {
run rsconnect remove -n ci-test
}

0 comments on commit 0d05e93

Please sign in to comment.