2021-02-09 20:17:06 +01:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2021-02-12 05:14:42 +01:00
|
|
|
photoprism "github.com/kris-nova/photoprism-client-go"
|
2021-02-09 20:17:06 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// TestHappyLogin should succeed with the good password "missy"
|
|
|
|
func TestHappyLogin(t *testing.T) {
|
2021-02-10 01:00:02 +01:00
|
|
|
client := photoprism.New(WellKnownSampleAppConnectionString)
|
|
|
|
err := client.Auth(photoprism.NewClientAuthLogin(WellKnownUser, WellKnownPass))
|
2021-02-09 20:17:06 +01:00
|
|
|
if err != nil {
|
2021-02-10 01:00:02 +01:00
|
|
|
t.Errorf("expected login: %v", err)
|
|
|
|
t.FailNow()
|
2021-02-09 20:17:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// TestSadLogin should fail with the bad password "charlie"
|
|
|
|
func TestSadLogin(t *testing.T) {
|
2021-02-10 01:00:02 +01:00
|
|
|
client := photoprism.New(WellKnownSampleAppConnectionString)
|
|
|
|
err := client.Auth(photoprism.NewClientAuthLogin(WellKnownUser, BadPassword))
|
2021-02-09 20:17:06 +01:00
|
|
|
if err == nil {
|
2021-02-10 01:00:02 +01:00
|
|
|
t.Errorf("expecting error for known bad password")
|
|
|
|
t.FailNow()
|
2021-02-09 20:17:06 +01:00
|
|
|
}
|
|
|
|
}
|