Skip to content

Commit

Permalink
add tests for pathFor{Container,Blob}() and fix test for blobSASStrin…
Browse files Browse the repository at this point in the history
…gToSign
  • Loading branch information
jf committed Jan 30, 2015
1 parent e39d38e commit 612a5f5
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions clients/storage/blob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,21 @@ import (

const testContainerPrefix = "zzzztest-"

func TestblobSASStringToSign(t *testing.T) {
func Test_pathForContainer(t *testing.T) {
out := pathForContainer("foo")
if expected := "/foo"; out != expected {
t.Errorf("Wrong pathForContainer. Expected: '%s', got: '%s'", expected, out)
}
}

func Test_pathForBlob(t *testing.T) {
out := pathForBlob("foo", "blob")
if expected := "/foo/blob"; out != expected {
t.Errorf("Wrong pathForBlob. Expected: '%s', got: '%s'", expected, out)
}
}

func Test_blobSASStringToSign(t *testing.T) {
_, err := blobSASStringToSign("2012-02-12", "CS", "SE", "SP")
if err == nil {
t.Fatal("Expected error, got nil")
Expand All @@ -30,7 +44,7 @@ func TestblobSASStringToSign(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if expected := "SP\n\nSE\nCS\n\n\n2013-08-15\n%s\n%s\n%s\n%s\n%s"; out != expected {
if expected := "SP\n\nSE\nCS\n\n2013-08-15\n\n\n\n\n"; out != expected {
t.Errorf("Wrong stringToSign. Expected: '%s', got: '%s'", expected, out)
}
}
Expand Down

0 comments on commit 612a5f5

Please sign in to comment.