[ARVADOS] updated: 1d0d4b16be0e9478dd6f98014a30610c5e579afa

git at public.curoverse.com git at public.curoverse.com
Thu Oct 16 11:45:09 EDT 2014


Summary of changes:
 services/keepstore/perms_test.go | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

       via  1d0d4b16be0e9478dd6f98014a30610c5e579afa (commit)
      from  5e2eeeaabfdd2673ee58cc0da54e943fd2841d04 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 1d0d4b16be0e9478dd6f98014a30610c5e579afa
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Oct 16 11:34:16 2014 -0400

    4219: Add test for missing size hint. Dry up "known signature hint" consts.

diff --git a/services/keepstore/perms_test.go b/services/keepstore/perms_test.go
index a2aa725..d0081cd 100644
--- a/services/keepstore/perms_test.go
+++ b/services/keepstore/perms_test.go
@@ -5,7 +5,7 @@ import (
 	"time"
 )
 
-var (
+const (
 	known_hash    = "acbd18db4cc2f85cedef654fccc4a4d8"
 	known_locator = known_hash + "+3"
 	known_token   = "hocfupkn2pjhrpgp2vxv8rsku7tvtx49arbc9s4bvu7p7wxqvk"
@@ -18,7 +18,8 @@ var (
 		"786u5rw2a9gx743dj3fgq2irk"
 	known_signature      = "257f3f5f5f0a4e4626a18fc74bd42ec34dcb228a"
 	known_timestamp      = "7fffffff"
-	known_signed_locator = known_locator + "+A" + known_signature + "@" + known_timestamp
+	known_sig_hint       = "+A" + known_signature + "@" + known_timestamp
+	known_signed_locator = known_locator + known_sig_hint
 )
 
 func TestSignLocator(t *testing.T) {
@@ -47,17 +48,15 @@ func TestVerifySignatureExtraHints(t *testing.T) {
 	PermissionSecret = []byte(known_key)
 	defer func() { PermissionSecret = nil }()
 
-	sig_stuff := "+A" + known_signature + "@" + known_timestamp
-
-	if !VerifySignature(known_locator + "+K at xyzzy" + sig_stuff, known_token) {
+	if !VerifySignature(known_locator + "+K at xyzzy" + known_sig_hint, known_token) {
 		t.Fatal("Verify cannot handle hint before permission signature")
 	}
 
-	if !VerifySignature(known_locator + sig_stuff + "+Zfoo", known_token) {
+	if !VerifySignature(known_locator + known_sig_hint + "+Zfoo", known_token) {
 		t.Fatal("Verify cannot handle hint after permission signature")
 	}
 
-	if !VerifySignature(known_locator + "+K at xyzzy" + sig_stuff + "+Zfoo", known_token) {
+	if !VerifySignature(known_locator + "+K at xyzzy" + known_sig_hint + "+Zfoo", known_token) {
 		t.Fatal("Verify cannot handle hints around permission signature")
 	}
 }
@@ -67,9 +66,12 @@ func TestVerifySignatureWrongSize(t *testing.T) {
 	PermissionSecret = []byte(known_key)
 	defer func() { PermissionSecret = nil }()
 
-	signed_locator_wrong_size := known_hash + "+999999+A" + known_signature + "@" + known_timestamp
-	if !VerifySignature(signed_locator_wrong_size, known_token) {
-		t.Fail()
+	if !VerifySignature(known_hash + "+999999" + known_sig_hint, known_token) {
+		t.Fatal("Verify cannot handle incorrect size hint")
+	}
+
+	if !VerifySignature(known_hash + known_sig_hint, known_token) {
+		t.Fatal("Verify cannot handle missing size hint")
 	}
 }
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list