Merge lp:~allenap/gwacl/camel-lint into lp:gwacl

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: 140
Merged at revision: 140
Proposed branch: lp:~allenap/gwacl/camel-lint
Merge into: lp:gwacl
Diff against target: 661 lines (+129/-128)
8 files modified
helpers_apiobjects_test.go (+2/-2)
helpers_factory_test.go (+2/-2)
storage_base.go (+38/-37)
storage_base_test.go (+35/-35)
storage_test.go (+8/-8)
x509session.go (+3/-3)
xmlobjects.go (+2/-2)
xmlobjects_test.go (+39/-39)
To merge this branch: bzr merge lp:~allenap/gwacl/camel-lint
Reviewer Review Type Date Requested Status
Gavin Panella Approve
Review via email: mp+171804@code.launchpad.net

Commit message

Camel-case all variables.

Description of the change

I wasn't feeling too sharp, so I did this as a warm-up exercise :)

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :

Self-approving to get the pill down quickly. It hardly conflicts with current WIP too.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'helpers_apiobjects_test.go'
2--- helpers_apiobjects_test.go 2013-04-30 05:13:33 +0000
3+++ helpers_apiobjects_test.go 2013-06-27 13:34:32 +0000
4@@ -46,14 +46,14 @@
5 hostname := MakeRandomString(10)
6 username := MakeRandomString(10)
7 password := MakeRandomString(10)
8- disable_ssh := MakeRandomBool()
9+ disableSSH := MakeRandomBool()
10
11 return &LinuxProvisioningConfiguration{
12 ConfigurationSetType: "LinuxProvisioningConfiguration",
13 Hostname: hostname,
14 Username: username,
15 Password: password,
16- DisableSSHPasswordAuthentication: disable_ssh}
17+ DisableSSHPasswordAuthentication: disableSSH}
18 }
19
20 func makeOSVirtualHardDisk() *OSVirtualHardDisk {
21
22=== modified file 'helpers_factory_test.go'
23--- helpers_factory_test.go 2013-04-30 05:13:33 +0000
24+++ helpers_factory_test.go 2013-06-27 13:34:32 +0000
25@@ -27,8 +27,8 @@
26 dest := make([]byte, length)
27 for i := range dest {
28 num := rand.Intn(len(chars))
29- rand_char := chars[num]
30- dest[i] = rand_char
31+ randChar := chars[num]
32+ dest[i] = randChar
33 }
34 return dest
35 }
36
37=== modified file 'storage_base.go'
38--- storage_base.go 2013-06-26 13:42:49 +0000
39+++ storage_base.go 2013-06-27 13:34:32 +0000
40@@ -27,7 +27,7 @@
41 "time"
42 )
43
44-var headers_to_sign = []string{
45+var headersToSign = []string{
46 "Content-Encoding",
47 "Content-Language",
48 "Content-Length",
49@@ -42,32 +42,32 @@
50 }
51
52 // Calculate the value required for an Authorization header.
53-func composeAuthHeader(req *http.Request, account_name, account_key string) string {
54- signable := composeStringToSign(req, account_name)
55+func composeAuthHeader(req *http.Request, accountName, accountKey string) string {
56+ signable := composeStringToSign(req, accountName)
57 // Allegedly, this is already UTF8 encoded.
58- decoded_key, err := base64.StdEncoding.DecodeString(account_key)
59+ decodedKey, err := base64.StdEncoding.DecodeString(accountKey)
60 if err != nil {
61 panic(fmt.Errorf("invalid account key: %s", err))
62 }
63- hash := hmac.New(sha256.New, decoded_key)
64+ hash := hmac.New(sha256.New, decodedKey)
65 _, err = hash.Write([]byte(signable))
66 if err != nil {
67 panic(fmt.Errorf("failed to write hash: %s", err))
68 }
69 var hashed []byte
70 hashed = hash.Sum(hashed)
71- b64_hashed := base64.StdEncoding.EncodeToString(hashed)
72- return fmt.Sprintf("SharedKey %s:%s", account_name, b64_hashed)
73+ b64Hashed := base64.StdEncoding.EncodeToString(hashed)
74+ return fmt.Sprintf("SharedKey %s:%s", accountName, b64Hashed)
75 }
76
77 // Calculate the string that needs to be HMAC signed. It is comprised of
78-// the headers in headers_to_sign, x-ms-* headers and the URI params.
79-func composeStringToSign(req *http.Request, account_name string) string {
80+// the headers in headersToSign, x-ms-* headers and the URI params.
81+func composeStringToSign(req *http.Request, accountName string) string {
82 // TODO: whitespace should be normalised in value strings.
83 return fmt.Sprintf(
84 "%s\n%s%s%s", req.Method, composeHeaders(req),
85 composeCanonicalizedHeaders(req),
86- composeCanonicalizedResource(req, account_name))
87+ composeCanonicalizedResource(req, accountName))
88 }
89
90 // toLowerKeys lower cases all map keys. If two keys exist, that differ
91@@ -103,8 +103,8 @@
92 // Calculate the headers required in the string to sign.
93 func composeHeaders(req *http.Request) string {
94 var result []string
95- for _, header_name := range headers_to_sign {
96- result = append(result, req.Header.Get(header_name)+"\n")
97+ for _, headerName := range headersToSign {
98+ result = append(result, req.Header.Get(headerName)+"\n")
99 }
100 return strings.Join(result, "")
101 }
102@@ -112,10 +112,10 @@
103 // Calculate the x-ms-* headers, encode as for encodeParams.
104 func composeCanonicalizedHeaders(req *http.Request) string {
105 var results []string
106- for header_name, values := range req.Header {
107- header_name = strings.ToLower(header_name)
108- if strings.HasPrefix(header_name, "x-ms-") {
109- results = append(results, fmt.Sprintf("%v:%s\n", header_name, strings.Join(values, ",")))
110+ for headerName, values := range req.Header {
111+ headerName = strings.ToLower(headerName)
112+ if strings.HasPrefix(headerName, "x-ms-") {
113+ results = append(results, fmt.Sprintf("%v:%s\n", headerName, strings.Join(values, ",")))
114 }
115 }
116 sort.Strings(results)
117@@ -125,27 +125,27 @@
118 // Calculate the URI params and encode them in the string.
119 // See http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx
120 // for details of this encoding.
121-func composeCanonicalizedResource(req *http.Request, account_name string) string {
122+func composeCanonicalizedResource(req *http.Request, accountName string) string {
123 path := req.URL.Path
124 if !strings.HasPrefix(path, "/") {
125 path = "/" + path
126 }
127
128 values := req.URL.Query()
129- values_lower := toLowerKeys(values)
130- param_string := encodeParams(values_lower)
131+ valuesLower := toLowerKeys(values)
132+ paramString := encodeParams(valuesLower)
133
134- result := "/" + account_name + path
135- if param_string != "" {
136- result += "\n" + param_string
137+ result := "/" + accountName + path
138+ if paramString != "" {
139+ result += "\n" + paramString
140 }
141
142 return result
143 }
144
145-// Take the passed ms_version string and add it to the request headers.
146-func addVersionHeader(req *http.Request, ms_version string) {
147- req.Header.Set("x-ms-version", ms_version)
148+// Take the passed msVersion string and add it to the request headers.
149+func addVersionHeader(req *http.Request, msVersion string) {
150+ req.Header.Set("x-ms-version", msVersion)
151 }
152
153 // Calculate the mD5sum and content length for the request payload and add
154@@ -191,8 +191,8 @@
155 }
156
157 // StorageContext keeps track of the mandatory parameters required to send a
158-// request to the storage services API. It also has an http Client so that
159-// the client is only created once for all requests.
160+// request to the storage services API. It also has an HTTP Client to allow
161+// overriding for custom behaviour, during testing for example.
162 type StorageContext struct {
163 Account string
164 // Access key: access will be anonymous if the key is the empty string.
165@@ -200,8 +200,9 @@
166 client *http.Client
167 }
168
169-// getClient is used when sending a request. If called with an existing client
170-// it will replace the once in the context structure which is useful for tests.
171+// getClient is used when sending a request. If a custom client is specified
172+// in context.client it is returned, otherwise net.http.DefaultClient is
173+// returned.
174 func (context *StorageContext) getClient() *http.Client {
175 if context.client == nil {
176 return http.DefaultClient
177@@ -272,12 +273,12 @@
178 // The "res" parameter is typically an XML struct that will deserialize the
179 // raw XML into the struct data. The http Response object is returned.
180 //
181-// If the response's HTTP status code is not the same as "expected_status"
182+// If the response's HTTP status code is not the same as "expectedStatus"
183 // then an HTTPError will be returned as the error. When the returned error
184 // is an HTTPError, the request response is also returned. In other error
185 // cases, the returned response may be the one received from the server or
186 // it may be nil.
187-func (context *StorageContext) send(req *http.Request, res Deserializer, expected_status HTTPStatus) (*http.Response, error) {
188+func (context *StorageContext) send(req *http.Request, res Deserializer, expectedStatus HTTPStatus) (*http.Response, error) {
189 client := context.getClient()
190 resp, err := client.Do(req)
191 if err != nil {
192@@ -286,7 +287,7 @@
193
194 var data []byte
195
196- if resp.StatusCode != int(expected_status) {
197+ if resp.StatusCode != int(expectedStatus) {
198 if resp.Body != nil {
199 data, err = ioutil.ReadAll(resp.Body)
200 if err != nil {
201@@ -445,7 +446,7 @@
202 case "block":
203 blobType = "BlockBlob"
204 default:
205- panic("block_type must be 'page' or 'block'")
206+ panic("blockType must be 'page' or 'block'")
207 }
208
209 extraHeaders := http.Header{}
210@@ -536,11 +537,11 @@
211 // Send a request to create a new block. The request payload contains the
212 // data block to upload.
213 func (context *StorageContext) PutBlock(container, filename, id string, data io.Reader) error {
214- base64_id := base64.StdEncoding.EncodeToString([]byte(id))
215+ base64ID := base64.StdEncoding.EncodeToString([]byte(id))
216 uri := addURLQueryParams(
217 context.GetFileURL(container, filename),
218 "comp", "block",
219- "blockid", base64_id)
220+ "blockid", base64ID)
221 _, err := context.performRequest(requestParams{
222 Method: "PUT",
223 URL: uri,
224@@ -564,12 +565,12 @@
225 if err != nil {
226 return err
227 }
228- data_reader := bytes.NewReader(data)
229+ dataReader := bytes.NewReader(data)
230
231 _, err = context.performRequest(requestParams{
232 Method: "PUT",
233 URL: uri,
234- Body: data_reader,
235+ Body: dataReader,
236 APIVersion: "2012-02-12",
237 ExpectedStatus: http.StatusCreated,
238 })
239
240=== modified file 'storage_base_test.go'
241--- storage_base_test.go 2013-06-25 00:51:32 +0000
242+++ storage_base_test.go 2013-06-27 13:34:32 +0000
243@@ -43,9 +43,9 @@
244 c.Assert(err, IsNil)
245
246 var items []string
247- for i, header_name := range headers_to_sign {
248+ for i, headerName := range headersToSign {
249 v := fmt.Sprintf("%d", i)
250- req.Header.Set(header_name, v)
251+ req.Header.Set(headerName, v)
252 items = append(items, v+"\n")
253 }
254 expected := strings.Join(items, "")
255@@ -75,9 +75,9 @@
256 c.Assert(err, IsNil)
257 path := MakeRandomString(10)
258 req.URL.Path = path
259- account_name := MakeRandomString(10)
260- observed := composeCanonicalizedResource(req, account_name)
261- expected := "/" + account_name + "/" + path
262+ accountName := MakeRandomString(10)
263+ observed := composeCanonicalizedResource(req, accountName)
264+ expected := "/" + accountName + "/" + path
265 c.Assert(observed, Equals, expected)
266 }
267
268@@ -86,9 +86,9 @@
269 req, err := http.NewRequest("GET", fmt.Sprintf("http://example.com/%s", path), nil)
270 c.Assert(err, IsNil)
271
272- account_name := MakeRandomString(10)
273- observed := composeCanonicalizedResource(req, account_name)
274- expected := "/" + account_name + "/" + path
275+ accountName := MakeRandomString(10)
276+ observed := composeCanonicalizedResource(req, accountName)
277+ expected := "/" + accountName + "/" + path
278 c.Assert(observed, Equals, expected)
279 }
280
281@@ -97,9 +97,9 @@
282 "GET", "http://example.com/?Kevin=Perry&foo=bar", nil)
283 c.Assert(err, IsNil)
284
285- account_name := MakeRandomString(10)
286- observed := composeCanonicalizedResource(req, account_name)
287- expected := "/" + account_name + "/\n" + "foo:bar" + "\n" + "kevin:Perry"
288+ accountName := MakeRandomString(10)
289+ observed := composeCanonicalizedResource(req, accountName)
290+ expected := "/" + accountName + "/\n" + "foo:bar" + "\n" + "kevin:Perry"
291 c.Assert(observed, Equals, expected)
292 }
293
294@@ -152,8 +152,8 @@
295 req, err := http.NewRequest(
296 "GET", "http://example.com/mypath?Kevin=Perry&foo=bar", nil)
297 c.Assert(err, IsNil)
298- for i, header_name := range headers_to_sign {
299- req.Header.Set(header_name, fmt.Sprintf("%v", i))
300+ for i, headerName := range headersToSign {
301+ req.Header.Set(headerName, fmt.Sprintf("%v", i))
302 }
303 req.Header.Set("x-ms-testing", "foo")
304 expected := "GET\n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\nx-ms-testing:foo\n/myaccount/mypath\nfoo:bar\nkevin:Perry"
305@@ -235,16 +235,16 @@
306 req, err := http.NewRequest("GET", "http://example.com/", nil)
307 c.Assert(err, IsNil)
308 addContentHeaders(req)
309- _, length_present := req.Header[http.CanonicalHeaderKey("Content-Length")]
310- c.Assert(length_present, Equals, false)
311+ _, lengthPresent := req.Header[http.CanonicalHeaderKey("Content-Length")]
312+ c.Assert(lengthPresent, Equals, false)
313 }
314
315 func (suite *TestRequestHeaders) TestContentHeaderWithNoBody(c *C) {
316 req, err := http.NewRequest("PUT", "http://example.com/", nil)
317 c.Assert(err, IsNil)
318 addContentHeaders(req)
319- _, md5_present := req.Header[http.CanonicalHeaderKey("Content-MD5")]
320- c.Check(md5_present, Equals, false)
321+ _, md5Present := req.Header[http.CanonicalHeaderKey("Content-MD5")]
322+ c.Check(md5Present, Equals, false)
323 content := req.Header.Get("Content-Length")
324 c.Check(content, Equals, "0")
325 }
326@@ -255,9 +255,9 @@
327 c.Assert(req.Header.Get("Date"), Equals, "")
328 addDateHeader(req)
329 observed := req.Header.Get("Date")
330- observed_time, err := time.Parse(time.RFC1123, observed)
331+ observedTime, err := time.Parse(time.RFC1123, observed)
332 c.Assert(err, IsNil)
333- difference := time.Now().UTC().Sub(observed_time)
334+ difference := time.Now().UTC().Sub(observedTime)
335 if difference.Minutes() > 1.0 {
336 c.FailNow()
337 }
338@@ -606,12 +606,12 @@
339 response := makeHttpResponse(http.StatusCreated, "")
340 transport := &TestTransport{Response: response}
341 context := makeStorageContext(transport)
342- container_name := MakeRandomString(10)
343- err := context.CreateContainer(container_name)
344+ containerName := MakeRandomString(10)
345+ err := context.CreateContainer(containerName)
346 c.Assert(err, IsNil)
347 c.Check(transport.Request.URL.String(), Equals, fmt.Sprintf(
348 "http://%s.blob.core.windows.net/%s?restype=container",
349- context.Account, container_name))
350+ context.Account, containerName))
351 c.Check(transport.Request.Header.Get("Authorization"), Not(Equals), "")
352 }
353
354@@ -787,7 +787,7 @@
355 func (suite *TestPutBlob) TestBlobType(c *C) {
356 defer func() {
357 err := recover()
358- c.Assert(err, Equals, "block_type must be 'page' or 'block'")
359+ c.Assert(err, Equals, "blockType must be 'page' or 'block'")
360 }()
361 context := makeStorageContext(&TestTransport{})
362 context.PutBlob(&PutBlobRequest{
363@@ -839,31 +839,31 @@
364 transport := &TestTransport{Response: response}
365 context := makeStorageContext(transport)
366 blockid := "\x1b\xea\xf7Mv\xb5\xddH\xebm"
367- random_data := MakeRandomByteSlice(10)
368- data_reader := bytes.NewReader(random_data)
369- err := context.PutBlock("container", "blobname", blockid, data_reader)
370+ randomData := MakeRandomByteSlice(10)
371+ dataReader := bytes.NewReader(randomData)
372+ err := context.PutBlock("container", "blobname", blockid, dataReader)
373 c.Assert(err, IsNil)
374
375 // The blockid should have been base64 encoded and url escaped.
376- base64_id := base64.StdEncoding.EncodeToString([]byte(blockid))
377+ base64ID := base64.StdEncoding.EncodeToString([]byte(blockid))
378 c.Check(transport.Request.URL.String(), Matches, context.GetFileURL("container", "blobname")+"?.*")
379 c.Check(transport.Request.URL.Query(), DeepEquals, url.Values{
380 "comp": {"block"},
381- "blockid": {base64_id},
382+ "blockid": {base64ID},
383 })
384 c.Check(transport.Request.Header.Get("Authorization"), Not(Equals), "")
385
386 data, err := ioutil.ReadAll(transport.Request.Body)
387 c.Assert(err, IsNil)
388- c.Check(data, DeepEquals, random_data)
389+ c.Check(data, DeepEquals, randomData)
390 }
391
392 // Client-side errors from the HTTP client are propagated back to the caller.
393 func (suite *TestPutBlock) TestError(c *C) {
394 error := fmt.Errorf("canned-error")
395 context := makeStorageContext(&TestTransport{Error: error})
396- data_reader := bytes.NewReader(MakeRandomByteSlice(10))
397- err := context.PutBlock("container", "blobname", "blockid", data_reader)
398+ dataReader := bytes.NewReader(MakeRandomByteSlice(10))
399+ err := context.PutBlock("container", "blobname", "blockid", dataReader)
400 c.Assert(err, NotNil)
401 }
402
403@@ -872,8 +872,8 @@
404 responseBody := "<Error><Code>Frotzed</Code><Message>failed to put block</Message></Error>"
405 response := makeHttpResponse(102, responseBody)
406 context := makeStorageContext(&TestTransport{Response: response})
407- data_reader := bytes.NewReader(MakeRandomByteSlice(10))
408- err := context.PutBlock("container", "blobname", "blockid", data_reader)
409+ dataReader := bytes.NewReader(MakeRandomByteSlice(10))
410+ err := context.PutBlock("container", "blobname", "blockid", dataReader)
411 c.Assert(err, NotNil)
412 c.Check(err, ErrorMatches, ".*102.*")
413 c.Check(err, ErrorMatches, ".*Frotzed.*")
414@@ -885,8 +885,8 @@
415 func (suite *TestPutBlock) TestServerError(c *C) {
416 response := makeHttpResponse(http.StatusNotFound, "not found")
417 context := makeStorageContext(&TestTransport{Response: response})
418- data_reader := bytes.NewReader(MakeRandomByteSlice(10))
419- err := context.PutBlock("container", "blobname", "blockid", data_reader)
420+ dataReader := bytes.NewReader(MakeRandomByteSlice(10))
421+ err := context.PutBlock("container", "blobname", "blockid", dataReader)
422 serverError, ok := err.(*ServerError)
423 c.Check(ok, Equals, true)
424 c.Check(serverError.HTTPStatus.StatusCode(), Equals, http.StatusNotFound)
425
426=== modified file 'storage_test.go'
427--- storage_test.go 2013-06-26 13:15:58 +0000
428+++ storage_test.go 2013-06-27 13:34:32 +0000
429@@ -105,7 +105,7 @@
430 // The ListAllBlobs Storage API call returns a BlobEnumerationResults struct
431 // on success.
432 func (suite *testListAllBlobs) Test(c *C) {
433- response_body := `
434+ responseBody := `
435 <?xml version="1.0" encoding="utf-8"?>
436 <EnumerationResults ContainerName="http://myaccount.blob.core.windows.net/mycontainer">
437 <Prefix>prefix</Prefix>
438@@ -152,7 +152,7 @@
439 response := &http.Response{
440 Status: fmt.Sprintf("%d", http.StatusOK),
441 StatusCode: http.StatusOK,
442- Body: makeResponseBody(response_body),
443+ Body: makeResponseBody(responseBody),
444 }
445 transport := &TestTransport{Response: response}
446 context := makeStorageContext(transport)
447@@ -240,7 +240,7 @@
448 // The ListAllContainers Storage API call returns a ContainerEnumerationResults
449 // struct on success.
450 func (suite *testListAllContainers) Test(c *C) {
451- response_body := `
452+ responseBody := `
453 <?xml version="1.0" encoding="utf-8"?>
454 <EnumerationResults AccountName="http://myaccount.blob.core.windows.net">
455 <Prefix>prefix-value</Prefix>
456@@ -267,7 +267,7 @@
457 response := &http.Response{
458 Status: fmt.Sprintf("%d", http.StatusOK),
459 StatusCode: http.StatusOK,
460- Body: makeResponseBody(response_body),
461+ Body: makeResponseBody(responseBody),
462 }
463 transport := &TestTransport{Response: response}
464 context := makeStorageContext(transport)
465@@ -373,10 +373,10 @@
466 c.Check(
467 transport.Exchanges[0].Request.Header.Get("x-ms-blob-type"),
468 Equals, "PageBlob")
469- expected_size := fmt.Sprintf("%d", VHD_SIZE)
470+ expectedSize := fmt.Sprintf("%d", VHD_SIZE)
471 c.Check(
472 transport.Exchanges[0].Request.Header.Get("x-ms-blob-content-length"),
473- Equals, expected_size)
474+ Equals, expectedSize)
475
476 // Check the PutPage for the footer exchange.
477 data, err := ioutil.ReadAll(transport.Exchanges[1].Request.Body)
478@@ -384,10 +384,10 @@
479 expectedData, err := base64.StdEncoding.DecodeString(VHD_FOOTER)
480 c.Assert(err, IsNil)
481 c.Check(data, DeepEquals, expectedData)
482- expected_range := fmt.Sprintf("bytes=%d-%d", VHD_SIZE-512, VHD_SIZE-1)
483+ expectedRange := fmt.Sprintf("bytes=%d-%d", VHD_SIZE-512, VHD_SIZE-1)
484 c.Check(
485 transport.Exchanges[1].Request.Header.Get("x-ms-range"),
486- Equals, expected_range)
487+ Equals, expectedRange)
488
489 // Check the PutPage for the data exchange.
490 data, err = ioutil.ReadAll(transport.Exchanges[2].Request.Body)
491
492=== modified file 'x509session.go'
493--- x509session.go 2013-04-30 05:36:03 +0000
494+++ x509session.go 2013-06-27 13:34:32 +0000
495@@ -30,16 +30,16 @@
496 if strings.HasPrefix(path, "/") {
497 panic(fmt.Errorf("got absolute API path '%s' instead of relative one", path))
498 }
499- azure_url, err := url.Parse(AZURE_URL)
500+ azureURL, err := url.Parse(AZURE_URL)
501 if err != nil {
502 panic(err)
503 }
504 escapedID := url.QueryEscape(session.subscriptionId)
505- path_url, err := url.Parse(escapedID + "/" + path)
506+ pathURL, err := url.Parse(escapedID + "/" + path)
507 if err != nil {
508 panic(err)
509 }
510- return azure_url.ResolveReference(path_url).String()
511+ return azureURL.ResolveReference(pathURL).String()
512 }
513
514 // _X509Dispatcher is the function used to dispatch requests. We call the
515
516=== modified file 'xmlobjects.go'
517--- xmlobjects.go 2013-06-26 09:05:55 +0000
518+++ xmlobjects.go 2013-06-27 13:34:32 +0000
519@@ -651,8 +651,8 @@
520
521 // Add a BlockListItem to a BlockList.
522 func (s *BlockList) Add(blockType BlockListType, blockID string) {
523- base64_id := base64.StdEncoding.EncodeToString([]byte(blockID))
524- item := NewBlockListItem(blockType, base64_id)
525+ base64ID := base64.StdEncoding.EncodeToString([]byte(blockID))
526+ item := NewBlockListItem(blockType, base64ID)
527 s.Items = append(s.Items, item)
528 }
529
530
531=== modified file 'xmlobjects_test.go'
532--- xmlobjects_test.go 2013-06-26 10:44:48 +0000
533+++ xmlobjects_test.go 2013-06-27 13:34:32 +0000
534@@ -498,7 +498,7 @@
535
536 func (suite *xmlSuite) TestCreateStorageServiceInput(c *C) {
537 s := makeCreateStorageServiceInput()
538- ext_property := s.ExtendedProperties[0]
539+ extProperty := s.ExtendedProperties[0]
540 xml, err := s.Serialize()
541 c.Assert(err, IsNil)
542 template := dedent.Dedent(`
543@@ -517,8 +517,8 @@
544 </ExtendedProperties>
545 </CreateStorageServiceInput>`)
546 expected := fmt.Sprintf(template, s.ServiceName, s.Label, s.Description,
547- s.Location, s.AffinityGroup, s.GeoReplicationEnabled, ext_property.Name,
548- ext_property.Value)
549+ s.Location, s.AffinityGroup, s.GeoReplicationEnabled, extProperty.Name,
550+ extProperty.Value)
551 c.Assert(xml, Equals, expected)
552 }
553
554@@ -527,7 +527,7 @@
555 //
556
557 func (suite *xmlSuite) TestStorageServicesUnmarshal(c *C) {
558- input_template := `
559+ inputTemplate := `
560 <?xml version="1.0" encoding="utf-8"?>
561 <StorageServices xmlns="http://schemas.microsoft.com/windowsazure">
562 <StorageService>
563@@ -568,24 +568,24 @@
564 affinity := MakeRandomString(10)
565 label := MakeRandomString(10)
566 status := MakeRandomString(10)
567- blob_endpoint := MakeRandomString(10)
568- queue_endpoint := MakeRandomString(10)
569- table_endpoint := MakeRandomString(10)
570- geo_repl := BoolToString(MakeRandomBool())
571- geo_region := MakeRandomString(10)
572- status_primary := MakeRandomString(10)
573- failover_time := MakeRandomString(10)
574- geo_sec_region := MakeRandomString(10)
575- status_sec := MakeRandomString(10)
576- p1_name := MakeRandomString(10)
577- p1_val := MakeRandomString(10)
578- p2_name := MakeRandomString(10)
579- p2_val := MakeRandomString(10)
580+ blobEndpoint := MakeRandomString(10)
581+ queueEndpoint := MakeRandomString(10)
582+ tableEndpoint := MakeRandomString(10)
583+ geoRepl := BoolToString(MakeRandomBool())
584+ geoRegion := MakeRandomString(10)
585+ statusPrimary := MakeRandomString(10)
586+ failoverTime := MakeRandomString(10)
587+ geoSecRegion := MakeRandomString(10)
588+ statusSec := MakeRandomString(10)
589+ p1Name := MakeRandomString(10)
590+ p1Val := MakeRandomString(10)
591+ p2Name := MakeRandomString(10)
592+ p2Val := MakeRandomString(10)
593
594- input := fmt.Sprintf(input_template, url, servicename, desc, affinity,
595- label, status, blob_endpoint, queue_endpoint, table_endpoint, geo_repl,
596- geo_region, status_primary, failover_time, geo_sec_region, status_sec,
597- p1_name, p1_val, p2_name, p2_val)
598+ input := fmt.Sprintf(inputTemplate, url, servicename, desc, affinity,
599+ label, status, blobEndpoint, queueEndpoint, tableEndpoint, geoRepl,
600+ geoRegion, statusPrimary, failoverTime, geoSecRegion, statusSec,
601+ p1Name, p1Val, p2Name, p2Val)
602 data := []byte(input)
603
604 services := &StorageServices{}
605@@ -602,24 +602,24 @@
606 c.Check(s.AffinityGroup, Equals, affinity)
607 c.Check(s.Label, Equals, label)
608 c.Check(s.Status, Equals, status)
609- c.Check(s.GeoReplicationEnabled, Equals, geo_repl)
610- c.Check(s.GeoPrimaryRegion, Equals, geo_region)
611- c.Check(s.StatusOfPrimary, Equals, status_primary)
612- c.Check(s.LastGeoFailoverTime, Equals, failover_time)
613- c.Check(s.GeoSecondaryRegion, Equals, geo_sec_region)
614- c.Check(s.StatusOfSecondary, Equals, status_sec)
615+ c.Check(s.GeoReplicationEnabled, Equals, geoRepl)
616+ c.Check(s.GeoPrimaryRegion, Equals, geoRegion)
617+ c.Check(s.StatusOfPrimary, Equals, statusPrimary)
618+ c.Check(s.LastGeoFailoverTime, Equals, failoverTime)
619+ c.Check(s.GeoSecondaryRegion, Equals, geoSecRegion)
620+ c.Check(s.StatusOfSecondary, Equals, statusSec)
621
622 endpoints := s.Endpoints
623 c.Check(len(endpoints), Equals, 3)
624- c.Check(endpoints[0], Equals, blob_endpoint)
625- c.Check(endpoints[1], Equals, queue_endpoint)
626- c.Check(endpoints[2], Equals, table_endpoint)
627+ c.Check(endpoints[0], Equals, blobEndpoint)
628+ c.Check(endpoints[1], Equals, queueEndpoint)
629+ c.Check(endpoints[2], Equals, tableEndpoint)
630
631 properties := s.ExtendedProperties
632- c.Check(properties[0].Name, Equals, p1_name)
633- c.Check(properties[0].Value, Equals, p1_val)
634- c.Check(properties[1].Name, Equals, p2_name)
635- c.Check(properties[1].Value, Equals, p2_val)
636+ c.Check(properties[0].Name, Equals, p1Name)
637+ c.Check(properties[0].Value, Equals, p1Val)
638+ c.Check(properties[1].Name, Equals, p2Name)
639+ c.Check(properties[1].Value, Equals, p2Val)
640 }
641
642 func (suite *xmlSuite) TestBlobEnumerationResuts(c *C) {
643@@ -999,13 +999,13 @@
644 }
645
646 func (suite *xmlSuite) TestBlockListSerialize(c *C) {
647- block_list := &BlockList{
648+ blockList := &BlockList{
649 XMLName: xml.Name{Local: "BlockList"},
650 }
651- block_list.Add(BlockListCommitted, "first-base64-encoded-block-id")
652- block_list.Add(BlockListUncommitted, "second-base64-encoded-block-id")
653- block_list.Add(BlockListLatest, "third-base64-encoded-block-id")
654- observed, err := block_list.Serialize()
655+ blockList.Add(BlockListCommitted, "first-base64-encoded-block-id")
656+ blockList.Add(BlockListUncommitted, "second-base64-encoded-block-id")
657+ blockList.Add(BlockListLatest, "third-base64-encoded-block-id")
658+ observed, err := blockList.Serialize()
659 c.Assert(err, IsNil)
660 expected := dedent.Dedent(`
661 <BlockList>

Subscribers

People subscribed via source and target branches

to all changes: