Permalink
Browse files

imageservice: Rename Put|GetImageData() methods

To respectively Upload() and Download().

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information...
1 parent b520251 commit ab0ffaf27134cd4dcd56f7048f99df7c4ad5349b @sameo sameo committed Mar 2, 2016
@@ -68,8 +68,8 @@ func createTestImage(t *testing.T, client *gophercloud.ServiceClient) images.Ima
//uploading image data
data := []byte{1, 2, 3, 4, 5, 6, 7, 8, 9}
- putImageResult := images.PutImageData(client, image.ID, bytes.NewReader(data))
- th.AssertNoErr(t, putImageResult.Err)
+ uploadResult := images.Upload(client, image.ID, bytes.NewReader(data))
+ th.AssertNoErr(t, uploadResult.Err)
//checking status
image, err = images.Get(client, image.ID).Extract()
@@ -300,8 +300,8 @@ func (r ReplaceImageTags) ToImagePatchMap() map[string]interface{} {
return m
}
-// PutImageData uploads image file
-func PutImageData(client *gophercloud.ServiceClient, id string, data io.ReadSeeker) PutImageDataResult {
+// Upload uploads image file
+func Upload(client *gophercloud.ServiceClient, id string, data io.ReadSeeker) PutImageDataResult {
var res PutImageDataResult
_, res.Err = client.Put(imageDataURL(client, id), data, nil, &gophercloud.RequestOpts{
@@ -312,8 +312,8 @@ func PutImageData(client *gophercloud.ServiceClient, id string, data io.ReadSeek
return res
}
-// GetImageData retrieves file
-func GetImageData(client *gophercloud.ServiceClient, id string) GetImageDataResult {
+// Download retrieves file
+func Download(client *gophercloud.ServiceClient, id string) GetImageDataResult {
var res GetImageDataResult
var resp *http.Response
@@ -240,13 +240,13 @@ func TestUpdateImage(t *testing.T) {
th.AssertDeepEquals(t, &expectedImage, actualImage)
}
-func TestPutImageData(t *testing.T) {
+func TestUpload(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandlePutImageDataSuccessfully(t)
- PutImageData(
+ Upload(
fakeclient.ServiceClient(),
"da3b75d9-3f4a-40e7-8a2c-bfab23927dea",
readSeekerOfBytes([]byte{5, 3, 7, 24}))
@@ -300,13 +300,13 @@ func (rs *RS) Seek(offset int64, whence int) (int64, error) {
return int64(rs.offset), nil
}
-func TestGetImageData(t *testing.T) {
+func TestDownload(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleGetImageDataSuccessfully(t)
- rdr, err := GetImageData(fakeclient.ServiceClient(), "da3b75d9-3f4a-40e7-8a2c-bfab23927dea").Extract()
+ rdr, err := Download(fakeclient.ServiceClient(), "da3b75d9-3f4a-40e7-8a2c-bfab23927dea").Extract()
th.AssertNoErr(t, err)

0 comments on commit ab0ffaf

Please sign in to comment.