made dnaprotocol test more rigorous to ensure it really returns

results from each SID/servald instance.
Fixed bug in "keyring list" that was returning keyrings in
lower case instead of normalised form using overlay_render_sid()
This commit is contained in:
gardners 2012-06-21 16:04:14 +09:30
parent fa1cef7f3b
commit 0254ca0ab8
2 changed files with 12 additions and 9 deletions

View File

@ -1437,18 +1437,19 @@ int app_keyring_list(int argc, const char *const *argv, struct command_line_opti
{
int kpn;
keypair *kp;
unsigned char *sid=NULL,*did=NULL;
unsigned char *sid=NULL,*did=NULL,*name=NULL;
for(kpn=0;kpn<k->contexts[cn]->identities[in]->keypair_count;kpn++)
{
kp=k->contexts[cn]->identities[in]->keypairs[kpn];
if (kp->type==KEYTYPE_CRYPTOBOX) sid=kp->public_key;
if (kp->type==KEYTYPE_DID) did=kp->private_key;
if (kp->type==KEYTYPE_DID) { did=kp->private_key; name=kp->public_key; }
}
if (sid||did) {
int i;
if (sid) for(i=0;i<SID_SIZE;i++) cli_printf("%02x",sid[i]);
if (sid||did) {
if (sid) cli_printf("%s",overlay_render_sid(sid));
cli_delim(":");
if (did) cli_puts((char*)did);
cli_delim(":");
if (name) cli_puts((char*)name);
cli_delim("\n");
}
}

View File

@ -57,7 +57,9 @@ setup_servald_instances() {
touch $DUMMYNET
assert [ -e $DUMMYNET ]
setup_servald_instance A $DUMMYNET
SIDA=$sid
setup_servald_instance B $DUMMYNET
SIDB=$sid
# Now make sure that they can see each other
sleep 5 # Should be plenty of time
@ -86,8 +88,8 @@ test_DNAWildcardSearchFindsSelf() {
set_instance A
executeOk_servald dna lookup "*"
assertStdoutLineCount '==' 2
assertStdoutGrep --matches=1 "^sid://.*/5550001:5550001:Agent A Smith$"
assertStdoutGrep --matches=1 "^sid://.*/5550001:5550001:Agent B Smith$"
assertStdoutGrep --matches=1 "^sid://$SIDA/5550001:5550001:Agent A Smith$"
assertStdoutGrep --matches=1 "^sid://$SIDB/5550001:5550001:Agent B Smith$"
}
doc_DNAWildcardSearchFindsSelfEmpty="DNA lookup of wildcard (empty query method)"
@ -99,8 +101,8 @@ test_DNAWildcardSearchFindsSelfEmpty() {
set_instance A
executeOk_servald dna lookup ""
assertStdoutLineCount '==' 2
assertStdoutGrep --matches=1 "^sid://.*/5550001:5550001:Agent A Smith$"
assertStdoutGrep --matches=1 "^sid://.*/5550001:5550001:Agent B Smith$"
assertStdoutGrep --matches=1 "^sid://$SIDA/5550001:5550001:Agent A Smith$"
assertStdoutGrep --matches=1 "^sid://$SIDB/5550001:5550001:Agent B Smith$"
}