Adding GetAlbum method and unite tests

Signed-off-by: Kris Nóva <kris@nivenly.com>
This commit is contained in:
Kris Nóva 2021-02-11 13:46:28 -08:00
parent 0476727633
commit 6b742a1db4
9 changed files with 102 additions and 6 deletions

23
test/album_test.go Normal file
View file

@ -0,0 +1,23 @@
package test
import (
"testing"
)
func TestHappyGetAlbum(t *testing.T) {
_, err := Client.V1().GetAlbum(WellKnownAlbumID)
if err != nil {
t.Errorf("expected success getting well known album: %v", err)
t.FailNow()
}
}
func TestSadGetAlbum(t *testing.T) {
album, err := Client.V1().GetAlbum(UnknownAlbumID)
if err != nil {
t.Logf("success returning error for unknown album: %v", err)
return
}
t.Errorf("expected error for unknown album: %d", album.ID)
t.FailNow()
}

View file

@ -18,6 +18,8 @@ const (
BadPassword = "charlie"
WellKnownPhotoID = "pqnzigq351j2fqgn" // This is a photo in the persistent sample app
UnknownPhotoID = "1234567890"
WellKnownAlbumID = "aqnzih81icziiyae"
UnknownAlbumID = "1234567890"
WellKnownSampleAppConnectionString = "http://localhost:8080"
)
@ -51,7 +53,7 @@ func TestMain(m *testing.M) {
logger.Always("Success!")
os.Exit(0)
}()
}else {
} else {
logger.Always("Photoprism already running...")
}