Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions tests/config.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bats
load test-helper

@test "$clinom config (empty)" {
run "${clicmd}" config clear
run "${clicmd}" config
assert_output --partial 'config file is empty'
}

@test "$clinom config (random subcommand)" {
run "${clicmd}" config random-command
assert_output --partial 'options are supported'
}

@test "$clinom config (not empty)" {
run "${clicmd}" config add slack_apitoken xoxp-0000000000000-1111111111111-2222222222222
run "${clicmd}" config
assert_success
}

@test "$clinom config update" {
run "${clicmd}" config update slack_apitoken xoxp-0000000000000-1111111111111-2222222222222
assert_success
}

@test "$clinom config add" {
run "${clicmd}" config add slack_apitoken xoxp-0000000000000-1111111111111-2222222222222
assert_success
}

@test "$clinom config add (missing argument)" {
run "${clicmd}" config add
assert_output --partial 'missing varname or varvalue'
}

@test "$clinom config delete" {
run "${clicmd}" config delete slack_apitoken
assert_failure
}

@test "$clinom config delete (non-existent user)" {
run "${clicmd}" config delete slack_apitoken
assert_output --partial "doesn't exist"
}

@test "$clinom config clear" {
run "${clicmd}" config clear
[ ! -e /etc/treehouses.conf ]
assert_success
}