Docker: Rename and update dummy-webdav service

This commit is contained in:
Michael Mayer 2021-11-09 16:55:16 +01:00
parent ebc4ce928f
commit c029b2a78c
8 changed files with 31 additions and 27 deletions

View file

@ -11,7 +11,7 @@ services:
- apparmor:unconfined
depends_on:
- mariadb
- webdav-dummy
- dummy-webdav
volumes:
- "~/.cache/npm:/root/.cache/npm"
- "~/.cache/go-mod:/go/pkg/mod"
@ -154,5 +154,5 @@ services:
MYSQL_PASSWORD: photoprism
MYSQL_DATABASE: photoprism
webdav-dummy:
dummy-webdav:
image: photoprism/webdav:20211021

View file

@ -11,7 +11,7 @@ services:
image: photoprism/photoprism:develop
depends_on:
- postgres
- webdav-dummy
- dummy-webdav
security_opt:
- seccomp:unconfined
- apparmor:unconfined
@ -76,7 +76,7 @@ services:
POSTGRES_USER: photoprism
POSTGRES_PASSWORD: photoprism
webdav-dummy:
dummy-webdav:
image: photoprism/webdav:20211021
volumes:

View file

@ -9,7 +9,7 @@ services:
image: photoprism/photoprism:develop
depends_on:
- mariadb
- webdav-dummy
- dummy-webdav
security_opt:
- seccomp:unconfined
- apparmor:unconfined
@ -98,8 +98,12 @@ services:
MYSQL_PASSWORD: photoprism
MYSQL_DATABASE: photoprism
webdav-dummy:
image: photoprism/webdav:20211021
## Dummy WebDAV Server
dummy-webdav:
image: photoprism/dummy-webdav:20211109
environment:
WEBDAV_USERNAME: admin
WEBDAV_PASSWORD: photoprism
volumes:
go-mod:

View file

@ -19,7 +19,7 @@ func TestSearchAccounts(t *testing.T) {
val := gjson.Get(r.Body.String(), "#(AccName=\"Test Account\").AccURL")
count := gjson.Get(r.Body.String(), "#")
assert.LessOrEqual(t, int64(1), count.Int())
assert.Equal(t, "http://webdav-dummy/", val.String())
assert.Equal(t, "http://dummy-webdav/", val.String())
assert.Equal(t, http.StatusOK, r.Code)
})
t.Run("invalid request", func(t *testing.T) {
@ -111,7 +111,7 @@ func TestCreateAccount(t *testing.T) {
t.Run("successful request", func(t *testing.T) {
app, router, _ := NewApiTest()
CreateAccount(router)
r := PerformRequestWithBody(app, "POST", "/api/v1/accounts", `{"AccName": "CreateTest", "AccOwner": "Test", "AccUrl": "http://webdav-dummy/", "AccType": "webdav",
r := PerformRequestWithBody(app, "POST", "/api/v1/accounts", `{"AccName": "CreateTest", "AccOwner": "Test", "AccUrl": "http://dummy-webdav/", "AccType": "webdav",
"AccKey": "123", "AccUser": "admin", "AccPass": "photoprism", "AccError": "", "AccShare": false, "AccSync": false, "RetryLimit": 3, "SharePath": "", "ShareSize": "", "ShareExpires": 0,
"SyncPath": "", "SyncInterval": 3, "SyncUpload": false, "SyncDownload": false, "SyncFilenames": false, "SyncRaw": false}`)
val := gjson.Get(r.Body.String(), "AccOwner")
@ -123,7 +123,7 @@ func TestCreateAccount(t *testing.T) {
func TestUpdateAccount(t *testing.T) {
app, router, _ := NewApiTest()
CreateAccount(router)
r := PerformRequestWithBody(app, "POST", "/api/v1/accounts", `{"AccName": "CreateTest3", "AccOwner": "TestUpdate", "AccUrl": "http://webdav-dummy/", "AccType": "webdav",
r := PerformRequestWithBody(app, "POST", "/api/v1/accounts", `{"AccName": "CreateTest3", "AccOwner": "TestUpdate", "AccUrl": "http://dummy-webdav/", "AccType": "webdav",
"AccKey": "123", "AccUser": "admin", "AccPass": "photoprism", "AccError": "", "AccShare": false, "AccSync": false, "RetryLimit": 3, "SharePath": "", "ShareSize": "", "ShareExpires": 0,
"SyncPath": "", "SyncInterval": 5, "SyncUpload": false, "SyncDownload": false, "SyncFilenames": false, "SyncRaw": false}`)
val := gjson.Get(r.Body.String(), "AccOwner")
@ -131,7 +131,7 @@ func TestUpdateAccount(t *testing.T) {
val2 := gjson.Get(r.Body.String(), "SyncInterval")
assert.Equal(t, int64(5), val2.Int())
val3 := gjson.Get(r.Body.String(), "AccName")
assert.Equal(t, "Webdav-Dummy", val3.String())
assert.Equal(t, "Dummy-Webdav", val3.String())
assert.Equal(t, http.StatusOK, r.Code)
id := gjson.Get(r.Body.String(), "ID").String()
@ -170,7 +170,7 @@ func TestUpdateAccount(t *testing.T) {
func TestDeleteAccount(t *testing.T) {
app, router, _ := NewApiTest()
CreateAccount(router)
r := PerformRequestWithBody(app, "POST", "/api/v1/accounts", `{"AccName": "DeleteTest", "AccOwner": "TestDelete", "AccUrl": "http://webdav-dummy/", "AccType": "webdav",
r := PerformRequestWithBody(app, "POST", "/api/v1/accounts", `{"AccName": "DeleteTest", "AccOwner": "TestDelete", "AccUrl": "http://dummy-webdav/", "AccType": "webdav",
"AccKey": "123", "AccUser": "admin", "AccPass": "photoprism", "AccError": "", "AccShare": false, "AccSync": false, "RetryLimit": 3, "SharePath": "", "ShareSize": "", "ShareExpires": 0,
"SyncPath": "", "SyncInterval": 5, "SyncUpload": false, "SyncDownload": false, "SyncFilenames": false, "SyncRaw": false}`)
assert.Equal(t, http.StatusOK, r.Code)

View file

@ -7,11 +7,11 @@ import (
type AccountMap map[string]Account
var AccountFixtures = AccountMap{
"webdav-dummy": {
"dummy-webdav": {
ID: 1000000,
AccName: "Test Account",
AccOwner: "",
AccURL: "http://webdav-dummy/",
AccURL: "http://dummy-webdav/",
AccType: "webdav",
AccKey: "",
AccUser: "admin",
@ -36,11 +36,11 @@ var AccountFixtures = AccountMap{
UpdatedAt: TimeStamp(),
DeletedAt: nil,
},
"webdav-dummy2": {
"dummy-webdav2": {
ID: 1000001,
AccName: "Test Account2",
AccOwner: "",
AccURL: "http://webdav-dummy/",
AccURL: "http://dummy-webdav/",
AccType: "webdav",
AccKey: "",
AccUser: "admin",
@ -67,8 +67,8 @@ var AccountFixtures = AccountMap{
},
}
var AccountFixtureWebdavDummy = AccountFixtures["webdav-dummy"]
var AccountFixtureWebdavDummy2 = AccountFixtures["webdav-dummy2"]
var AccountFixtureWebdavDummy = AccountFixtures["dummy-webdav"]
var AccountFixtureWebdavDummy2 = AccountFixtures["dummy-webdav2"]
// CreateLabelFixtures inserts known entities into the database for testing.
func CreateAccountFixtures() {

View file

@ -116,7 +116,7 @@ func TestAccount_Delete(t *testing.T) {
func TestAccount_Directories(t *testing.T) {
t.Run("success", func(t *testing.T) {
account := Account{AccName: "DirectoriesAccount", AccOwner: "Owner", AccURL: "http://webdav-dummy/", AccType: "webdav", AccKey: "123", AccUser: "admin", AccPass: "photoprism",
account := Account{AccName: "DirectoriesAccount", AccOwner: "Owner", AccURL: "http://dummy-webdav/", AccType: "webdav", AccKey: "123", AccUser: "admin", AccPass: "photoprism",
AccError: "", AccShare: true, AccSync: true, RetryLimit: 4, SharePath: "/home", ShareSize: "500", ShareExpires: 3500, SyncPath: "/sync",
SyncInterval: 5, SyncUpload: true, SyncDownload: false, SyncFilenames: true, SyncRaw: false}
@ -141,7 +141,7 @@ func TestAccount_Directories(t *testing.T) {
})
t.Run("no directory", func(t *testing.T) {
account := Account{AccName: "DirectoriesAccount", AccOwner: "Owner", AccURL: "http://webdav-dummy/", AccType: "xxx", AccKey: "123", AccUser: "admin", AccPass: "photoprism",
account := Account{AccName: "DirectoriesAccount", AccOwner: "Owner", AccURL: "http://dummy-webdav/", AccType: "xxx", AccKey: "123", AccUser: "admin", AccPass: "photoprism",
AccError: "", AccShare: true, AccSync: true, RetryLimit: 4, SharePath: "/home", ShareSize: "500", ShareExpires: 3500, SyncPath: "/sync",
SyncInterval: 5, SyncUpload: true, SyncDownload: false, SyncFilenames: true, SyncRaw: false}

View file

@ -8,29 +8,29 @@ import (
func TestDiscover(t *testing.T) {
t.Run("webdav", func(t *testing.T) {
r, err := Discover("http://admin:photoprism@webdav-dummy/", "", "")
r, err := Discover("http://admin:photoprism@dummy-webdav/", "", "")
if err != nil {
t.Fatal(err)
}
assert.Equal(t, "Webdav-Dummy", r.AccName)
assert.Equal(t, "Dummy-Webdav", r.AccName)
assert.Equal(t, "webdav", r.AccType)
assert.Equal(t, "http://webdav-dummy/", r.AccURL)
assert.Equal(t, "http://dummy-webdav/", 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")
r, err := Discover("http://admin@dummy-webdav/", "", "photoprism")
if err != nil {
t.Fatal(err)
}
assert.Equal(t, "Webdav-Dummy", r.AccName)
assert.Equal(t, "Dummy-Webdav", r.AccName)
assert.Equal(t, "webdav", r.AccType)
assert.Equal(t, "http://webdav-dummy/", r.AccURL)
assert.Equal(t, "http://dummy-webdav/", r.AccURL)
assert.Equal(t, "admin", r.AccUser)
assert.Equal(t, "photoprism", r.AccPass)
})

View file

@ -11,7 +11,7 @@ import (
)
const (
testUrl = "http://webdav-dummy/"
testUrl = "http://dummy-webdav/"
testUser = "admin"
testPass = "photoprism"
)