Fixing found bug in UpdatePhoto UUID->photoUID

Signed-off-by: Kris Nóva <kris@nivenly.com>
main
Kris Nóva 2021-02-13 13:20:23 -08:00
parent 030b361d9e
commit 414bfb6aa1
17 changed files with 114 additions and 17 deletions

View File

@ -8,8 +8,6 @@ import (
"net/http"
"net/url"
"strings"
"github.com/kris-nova/logger"
)
const (
@ -49,8 +47,7 @@ type V1Response struct {
func (r *V1Response) String() string {
if r.Error != nil {
// Handle errors from the HTTP request first
logger.Warning("during HTTP request: %v", r.Error)
return "{}"
return fmt.Sprintf(`{\n"StatusCode":%d,\n"Body":"%s"}`, r.StatusCode, string(r.Body))
}
return string(r.Body)
}

View File

@ -8,7 +8,8 @@ package api
// uuid: string PhotoUID as returned by the API
func (v1 *V1Client) GetPhoto(uuid string) (Photo, error) {
photo := Photo{
UUID: uuid,
UUID: uuid,
PhotoUID: uuid,
}
err := v1.GET("/api/v1/photos/%s", uuid).JSON(&photo)
return photo, err
@ -68,7 +69,7 @@ func (v1 *V1Client) GetPhotos(options *PhotoOptions) ([]Photo, error) {
// Parameters:
// uuid: string PhotoUUID as returned by the API
func (v1 *V1Client) UpdatePhoto(photo Photo) (Photo, error) {
err := v1.PUT(&photo, "/api/v1/photos/%s", photo.UUID).JSON(&photo)
err := v1.PUT(&photo, "/api/v1/photos/%s", photo.PhotoUID).JSON(&photo)
return photo, err
}

View File

@ -0,0 +1,9 @@
UID: aqohke71tumtrylv
Slug: testalbum
Type: album
Title: TestAlbum
Order: oldest
Country: zz
CreatedAt: 2021-02-13T21:15:43Z
UpdatedAt: 2021-02-13T21:15:43Z
DeletedAt: 2021-02-13T21:15:43.345731557Z

View File

@ -0,0 +1,9 @@
UID: aqohke73547dz1jo
Slug: testalbum
Type: album
Title: TestAlbum
Order: oldest
Country: zz
CreatedAt: 2021-02-13T21:15:43Z
UpdatedAt: 2021-02-13T21:15:43Z
DeletedAt: 2021-02-13T21:15:43.381992763Z

View File

@ -0,0 +1,9 @@
UID: aqohke7d7mas6jk2
Slug: testalbum
Type: album
Title: TestAlbum
Order: oldest
Country: zz
CreatedAt: 2021-02-13T21:15:43Z
UpdatedAt: 2021-02-13T21:15:43Z
DeletedAt: 2021-02-13T21:15:43.317866775Z

View File

@ -0,0 +1,10 @@
UID: aqohke7f4o6p2sce
Slug: testalbum
Type: album
Title: TestAlbum
Description: An updated album description
Order: oldest
Country: zz
CreatedAt: 2021-02-13T21:15:43Z
UpdatedAt: 2021-02-13T21:15:43.255151603Z
DeletedAt: 2021-02-13T21:15:43.264952616Z

View File

@ -0,0 +1,10 @@
UID: aqohkhe1xjcaqsrd
Slug: testalbum
Type: album
Title: TestAlbum
Description: An updated album description
Order: oldest
Country: zz
CreatedAt: 2021-02-13T21:17:39Z
UpdatedAt: 2021-02-13T21:17:38.841222158Z
DeletedAt: 2021-02-13T21:17:38.853503411Z

View File

@ -0,0 +1,9 @@
UID: aqohkhe26dqinc9j
Slug: testalbum
Type: album
Title: TestAlbum
Order: oldest
Country: zz
CreatedAt: 2021-02-13T21:17:39Z
UpdatedAt: 2021-02-13T21:17:39Z
DeletedAt: 2021-02-13T21:17:38.900597291Z

View File

@ -0,0 +1,9 @@
UID: aqohkhe2oipmff1k
Slug: testalbum
Type: album
Title: TestAlbum
Order: oldest
Country: zz
CreatedAt: 2021-02-13T21:17:39Z
UpdatedAt: 2021-02-13T21:17:39Z
DeletedAt: 2021-02-13T21:17:38.934138694Z

View File

@ -0,0 +1,9 @@
UID: aqohkhe2r37lk7iu
Slug: testalbum
Type: album
Title: TestAlbum
Order: oldest
Country: zz
CreatedAt: 2021-02-13T21:17:39Z
UpdatedAt: 2021-02-13T21:17:39Z
DeletedAt: 2021-02-13T21:17:38.968679721Z

View File

@ -349,6 +349,11 @@
"tokens": null,
"expiration": 1613502943460686773
},
"7481e907c9cae79db11a2c7c4218ef7f6dd5617c417824e4": {
"user": "uqnzie01i1nypnt9",
"tokens": null,
"expiration": 1613855860314206613
},
"7a22f182d99dad428cc639c1c132060a7aaedb2dfdadf260": {
"user": "uqnzie01i1nypnt9",
"tokens": null,
@ -379,6 +384,11 @@
"tokens": null,
"expiration": 1613690716677589751
},
"800b2a021e4fa6b3caac3c552417ae5d89a6923490f5cab2": {
"user": "uqnzie01i1nypnt9",
"tokens": null,
"expiration": 1613855744621635920
},
"81000ef1dad0e84ef593d3838fb4ccb28a409d60cfaa7ef7": {
"user": "uqnzie01i1nypnt9",
"tokens": null,
@ -439,11 +449,21 @@
"tokens": null,
"expiration": 1613685115509915196
},
"88c85b1c7ec632eb070a80bfb5108904551943276989e945": {
"user": "uqnzie01i1nypnt9",
"tokens": null,
"expiration": 1613855858815200465
},
"8b98cdc875e6a849a9ab77ee44abef39bab4311dc7d19493": {
"user": "uqnzie01i1nypnt9",
"tokens": null,
"expiration": 1613675036520289034
},
"8c01731033c100ebab184ac2c6eca0c36ce58a31ecef3857": {
"user": "uqnzie01i1nypnt9",
"tokens": null,
"expiration": 1613855712406794763
},
"8c913bdc6bb46b9bf04573932ec058cf4efdcca6501041f3": {
"user": "uqnzie01i1nypnt9",
"tokens": null,
@ -799,6 +819,11 @@
"tokens": null,
"expiration": 1613522175097030333
},
"f448443b75da8fbfd58abbf55b82140e957bd2525827d5f0": {
"user": "uqnzie01i1nypnt9",
"tokens": null,
"expiration": 1613855743236077584
},
"f5495743ebbb224a6d212b84473c2ed92721f113b9c005ff": {
"user": "uqnzie01i1nypnt9",
"tokens": null,

View File

@ -1,4 +1,4 @@
TakenAt: 2021-02-04T03:21:40Z
TakenAt: 2021-02-13T21:07:49Z
UID: pqnzigq3sidxb0j0
Type: image
Title: Eptcef Voaeias
@ -9,4 +9,4 @@ Day: -1
Details:
Keywords: black, cat, eptcef, voaeias
CreatedAt: 2021-02-04T03:17:14.849461459Z
UpdatedAt: 2021-02-12T02:04:35.996772284Z
UpdatedAt: 2021-02-13T21:15:26.757415543Z

View File

@ -1,9 +1,9 @@
TakenAt: 2021-02-04T03:21:40Z
TakenAt: 2021-02-13T21:07:49Z
UID: pqnzigq351j2fqgn
Type: image
Title: A really great photo!
TitleSrc: manual
Description: 'Sample App Description: 2021-02-11 18:04:11.428496744 -0800 PST m=+6.520817628'
Description: 'Sample App Description: 2021-02-13 13:17:39.073524303 -0800 PST m=+6.526679853'
DescriptionSrc: manual
OriginalName: IMG_3044
Year: -1
@ -13,5 +13,5 @@ Details:
Keywords: green, tambourine
KeywordsSrc: manual
CreatedAt: 2021-02-04T03:17:14.613092062Z
UpdatedAt: 2021-02-12T02:04:35.895262838Z
EditedAt: 2021-02-12T02:04:11Z
UpdatedAt: 2021-02-13T21:17:39.081685026Z
EditedAt: 2021-02-13T21:17:39Z

View File

@ -1,4 +1,4 @@
TakenAt: 2021-02-04T03:21:40Z
TakenAt: 2021-02-13T21:07:49Z
UID: pqnzigq156lndozm
Type: image
Title: Test Nova
@ -10,5 +10,5 @@ Day: -1
Details:
Keywords: blue, elgexeiu, portrait
CreatedAt: 2021-02-04T03:17:14.668332772Z
UpdatedAt: 2021-02-12T02:04:36.057209628Z
UpdatedAt: 2021-02-13T21:15:26.714373058Z
EditedAt: 2021-02-09T18:39:46Z

View File

@ -1,4 +1,4 @@
TakenAt: 2021-02-04T03:21:40Z
TakenAt: 2021-02-13T21:07:49Z
UID: pqnzigq1jb1bibrz
Type: image
Title: Seashore
@ -9,4 +9,4 @@ Day: -1
Details:
Keywords: grey, seashore
CreatedAt: 2021-02-04T03:17:14.738798274Z
UpdatedAt: 2021-02-12T02:04:36.006365324Z
UpdatedAt: 2021-02-13T21:15:26.73725013Z

View File

@ -63,7 +63,7 @@ func TestSadUpdatePhoto(t *testing.T) {
t.FailNow()
return
}
photo.UUID = UnknownPhotoID
photo.PhotoUID = UnknownPhotoID
photo.PhotoDescription = fmt.Sprintf("Sample App Description: %s", time.Now().String())
photo, err = Client.V1().UpdatePhoto(photo)
if err != nil {