Issue #9, add test case for local HTTP add

This commit is contained in:
Andrew Bettison 2012-08-27 17:57:41 +09:30
parent 41680ff663
commit b3f9e437b3
2 changed files with 26 additions and 0 deletions

View File

@ -245,6 +245,10 @@ extract_manifest_filehash() {
extract_manifest "$1" "$2" filehash "$rexp_filehash"
}
extract_manifest_name() {
extract_manifest "$1" "$2" name ".*"
}
extract_manifest_version() {
extract_manifest "$1" "$2" version "$rexp_version"
}

View File

@ -251,4 +251,26 @@ test_Sync() {
assert_received file1
}
doc_HttpAddLocal="Add file locally using HTTP, returns manifest"
setup_HttpAddLocal() {
case "$(curl --version | tr '\n' ' ')" in
curl\ @(7|8|9|[1-9][0-1]).*\ Protocols:*\ http\ *) ;;
'') fail "curl(1) command is not present";;
*) fail "curl(1) version is not adequate (expecting 7 or higher)";;
esac
setup_common
start_servald_instances +A
wait_until rhizome_http_server_started +A
get_rhizome_server_port PORTA +A
}
test_HttpAddLocal() {
echo 'File file1' >file1
executeOk curl --silent --form 'file=@file1' "$addr_localhost:$PORTA" --output file1.manifest
assert_manifest_complete file1.manifest
executeOk_servald rhizome list ''
assert_rhizome_list file1
extract_manifest_name name file1.manifest
assert [ "$name" = file1 ]
}
runTests "$@"