2020-04-05 22:26:53 +02:00
|
|
|
package remote
|
2020-03-29 11:29:02 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestDiscover(t *testing.T) {
|
|
|
|
t.Run("webdav", func(t *testing.T) {
|
|
|
|
r, err := Discover("http://admin:photoprism@webdav-dummy/", "", "")
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2020-03-30 09:17:46 +02:00
|
|
|
assert.Equal(t, "Webdav", r.AccName)
|
2020-03-29 11:29:02 +02:00
|
|
|
assert.Equal(t, "webdav", r.AccType)
|
|
|
|
assert.Equal(t, "http://webdav-dummy/", r.AccURL)
|
|
|
|
assert.Equal(t, "admin", r.AccUser)
|
|
|
|
assert.Equal(t, "photoprism", r.AccPass)
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("webdav password", func(t *testing.T) {
|
|
|
|
r, err := Discover("http://admin@webdav-dummy/", "", "photoprism")
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2020-03-30 09:17:46 +02:00
|
|
|
assert.Equal(t, "Webdav", r.AccName)
|
2020-03-29 11:29:02 +02:00
|
|
|
assert.Equal(t, "webdav", r.AccType)
|
|
|
|
assert.Equal(t, "http://webdav-dummy/", r.AccURL)
|
|
|
|
assert.Equal(t, "admin", r.AccUser)
|
|
|
|
assert.Equal(t, "photoprism", r.AccPass)
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("facebook", func(t *testing.T) {
|
|
|
|
r, err := Discover("https://www.facebook.com/ob.boris.palmer", "", "")
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2020-03-30 09:17:46 +02:00
|
|
|
assert.Equal(t, "Facebook", r.AccName)
|
2020-03-29 11:29:02 +02:00
|
|
|
assert.Equal(t, "facebook", r.AccType)
|
|
|
|
assert.Equal(t, "https://www.facebook.com/ob.boris.palmer", r.AccURL)
|
|
|
|
assert.Equal(t, "", r.AccUser)
|
|
|
|
assert.Equal(t, "", r.AccPass)
|
|
|
|
})
|
|
|
|
}
|