(t *testing.T)
| 37 | } |
| 38 | |
| 39 | func TestStringToSign(t *testing.T) { |
| 40 | a := Auth{ |
| 41 | Account: "johnsmith", |
| 42 | } |
| 43 | tests := []reqAndExpected{ |
| 44 | {`GET /photos/puppy.jpg HTTP/1.1 |
| 45 | Host: johnsmith.blob.core.windows.net |
| 46 | Date: Tue, 27 Mar 2007 19:36:42 +0000 |
| 47 | |
| 48 | `, |
| 49 | "GET\n\n\n\n\n\nTue, 27 Mar 2007 19:36:42 +0000\n\n\n\n\n\n/johnsmith/photos/puppy.jpg"}, |
| 50 | {`PUT /photos/puppy.jpg HTTP/1.1 |
| 51 | Content-Type: image/jpeg |
| 52 | Content-Length: 94328 |
| 53 | Host: johnsmith.blob.core.windows.net |
| 54 | Date: Tue, 27 Mar 2007 21:15:45 +0000 |
| 55 | |
| 56 | `, |
| 57 | "PUT\n\n\n94328\n\nimage/jpeg\nTue, 27 Mar 2007 21:15:45 +0000\n\n\n\n\n\n/johnsmith/photos/puppy.jpg"}, |
| 58 | {`GET /?prefix=photos&maxResults=50&marker=puppy HTTP/1.1 |
| 59 | User-Agent: Mozilla/5.0 |
| 60 | Host: johnsmith.blob.core.windows.net |
| 61 | Date: Tue, 27 Mar 2007 19:42:41 +0000 |
| 62 | |
| 63 | `, |
| 64 | "GET\n\n\n\n\n\nTue, 27 Mar 2007 19:42:41 +0000\n\n\n\n\n\n/johnsmith/\nmarker:puppy\nmaxresults:50\nprefix:photos"}, |
| 65 | {`DELETE /photos/puppy.jpg HTTP/1.1 |
| 66 | User-Agent: dotnet |
| 67 | Host: blob.core.windows.net |
| 68 | Date: Tue, 27 Mar 2007 21:20:27 +0000 |
| 69 | x-ms-date: Tue, 27 Mar 2007 21:20:26 +0000 |
| 70 | |
| 71 | `, |
| 72 | "DELETE\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Tue, 27 Mar 2007 21:20:26 +0000\n/johnsmith/photos/puppy.jpg"}, |
| 73 | } |
| 74 | for idx, test := range tests { |
| 75 | got := a.stringToSign(req(test.req)) |
| 76 | if got != test.expected { |
| 77 | t.Errorf("test %d: expected %q", idx, test.expected) |
| 78 | t.Errorf("test %d: got %q", idx, got) |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | func TestSignRequest(t *testing.T) { |
| 84 | r := req("GET /foo HTTP/1.1\n\n") |
nothing calls this directly
no test coverage detected