예제 #1
0
			fakeBlobBucket.ListStub = func(prefix, delim, marker string, max int) (result *s3.ListResp, err error) {
				switch prefix {
				case "":
					return &s3.ListResp{
						Name:           "bucket-name",
						Prefix:         "",
						Delimiter:      "/",
						CommonPrefixes: []string{"X/", "Y/", "Z/"},
					}, nil
				case "X/":
					return &s3.ListResp{
						Name:      "bucket-name",
						Prefix:    "X/",
						Delimiter: "/",
						Contents: []s3.Key{
							s3.Key{Key: "X/bits.tgz", LastModified: "2006-01-02T15:04:05.999Z", Size: 100},
							s3.Key{Key: "X/droplet.tgz", LastModified: "2006-01-02T15:04:05.999Z", Size: 200},
							s3.Key{Key: "X/result.json", LastModified: "2006-01-02T15:04:05.999Z", Size: 300},
						},
					}, nil
				case "Y/":
					return &s3.ListResp{
						Name:      "bucket-name",
						Prefix:    "Y/",
						Delimiter: "/",
						Contents: []s3.Key{
							s3.Key{Key: "Y/bits.tgz"},
							s3.Key{Key: "Y/droplet.tgz"},
							s3.Key{Key: "Y/result.json"},
						},
					}, nil
				case "Z/":
					return &s3.ListResp{
						Name:      "bucket-name",
						Prefix:    "Z/",
						Delimiter: "/",
						Contents: []s3.Key{
							s3.Key{Key: "Z/bits.tgz"},
						},
					}, nil
				}

				Fail("no stub for arguments: " + prefix + "," + delim + "," + marker + "," + string(max))
				return nil, nil
			}
예제 #2
0
			fakeBlobBucket.ListStub = func(prefix, delim, marker string, max int) (result *s3.ListResp, err error) {
				if prefix == "" {
					return &s3.ListResp{
						Name:           "bucket-name",
						Prefix:         "",
						Delimiter:      "/",
						CommonPrefixes: []string{"X/", "Y/", "Z/"},
					}, nil
				} else if prefix == "X/" {
					return &s3.ListResp{
						Name:      "bucket-name",
						Prefix:    "X/",
						Delimiter: "/",
						Contents: []s3.Key{
							s3.Key{Key: "X/bits.tgz", LastModified: "2006-01-02T15:04:05.999Z"},
							s3.Key{Key: "X/droplet.tgz", LastModified: "2006-01-02T15:04:05.999Z"},
							s3.Key{Key: "X/result.json", LastModified: "2006-01-02T15:04:05.999Z"},
						},
					}, nil
				} else if prefix == "Y/" {
					return &s3.ListResp{
						Name:      "bucket-name",
						Prefix:    "Y/",
						Delimiter: "/",
						Contents: []s3.Key{
							s3.Key{Key: "Y/bits.tgz"},
							s3.Key{Key: "Y/droplet.tgz"},
							s3.Key{Key: "Y/result.json"},
						},
					}, nil
				} else if prefix == "Z/" {
					return &s3.ListResp{
						Name:      "bucket-name",
						Prefix:    "Z/",
						Delimiter: "/",
						Contents: []s3.Key{
							s3.Key{Key: "Z/bits.tgz"},
						},
					}, nil
				} else {
					panic("no stub for arguments: " + prefix + "," + delim + "," + marker + "," + string(max))
				}
			}