mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 05:07:56 +00:00
85 lines
2.5 KiB
Plaintext
85 lines
2.5 KiB
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
# Stress tests for Serval rhizome protocol.
|
||
|
#
|
||
|
# Copyright 2012 Serval Project, Inc.
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License
|
||
|
# as published by the Free Software Foundation; either version 2
|
||
|
# of the License, or (at your option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
|
||
|
source "${0%/*}/../testframework.sh"
|
||
|
source "${0%/*}/../testdefs.sh"
|
||
|
|
||
|
shopt -s extglob
|
||
|
|
||
|
setup() {
|
||
|
setup_servald
|
||
|
}
|
||
|
|
||
|
assert_keyring_list() {
|
||
|
assertStdoutLineCount --stdout --stderr '==' $1
|
||
|
tfw_cat --stdout
|
||
|
}
|
||
|
|
||
|
doc_KeyringCreate="Creating a keyring overrwites any existing keyring"
|
||
|
test_KeyringCreate() {
|
||
|
executeOk_servald keyring add ''
|
||
|
executeOk_servald keyring list
|
||
|
assert_keyring_list 1
|
||
|
executeOk_servald keyring create
|
||
|
assert_keyring_list 0
|
||
|
}
|
||
|
|
||
|
doc_KeyringPinless="Add and list all PIN-less keys"
|
||
|
test_KeyringPinless() {
|
||
|
executeOk_servald keyring add ''
|
||
|
executeOk_servald keyring list
|
||
|
assert_keyring_list 1
|
||
|
executeOk_servald keyring add ''
|
||
|
executeOk_servald keyring list
|
||
|
assert_keyring_list 2
|
||
|
executeOk_servald keyring add ''
|
||
|
executeOk_servald keyring list
|
||
|
assert_keyring_list 3
|
||
|
}
|
||
|
|
||
|
doc_KeyringEntryPin="Add and list PIN-locked keys"
|
||
|
test_KeyringEntryPin() {
|
||
|
executeOk_servald keyring add 'one'
|
||
|
executeOk_servald keyring list
|
||
|
assert_keyring_list 0
|
||
|
executeOk_servald keyring list 'one'
|
||
|
assert_keyring_list 1
|
||
|
executeOk_servald keyring add 'two'
|
||
|
executeOk_servald keyring list
|
||
|
assert_keyring_list 0
|
||
|
executeOk_servald keyring list 'one'
|
||
|
assert_keyring_list 1
|
||
|
executeOk_servald keyring list 'one,two'
|
||
|
assert_keyring_list 2
|
||
|
executeOk_servald keyring add 'three'
|
||
|
executeOk_servald keyring list
|
||
|
assert_keyring_list 0
|
||
|
executeOk_servald keyring list 'one'
|
||
|
assert_keyring_list 1
|
||
|
executeOk_servald keyring list 'one,two'
|
||
|
assert_keyring_list 2
|
||
|
executeOk_servald keyring list 'one,two,three'
|
||
|
assert_keyring_list 3
|
||
|
executeOk_servald keyring list 'two,three,one'
|
||
|
assert_keyring_list 3
|
||
|
}
|
||
|
|
||
|
runTests "$@"
|