mirror of
https://github.com/documize/community.git
synced 2025-07-22 22:59:43 +02:00
Enable in-app backup/restore for global/tenants
Re-mapping of ORG and USER ID values ensures conflict-free merging. Version numbers bumped. Co-Authored-By: Harvey Kandola <harvey@documize.com>
This commit is contained in:
parent
ec1939c01d
commit
db04057d9e
10 changed files with 913 additions and 788 deletions
59
domain/backup/restore_test.go
Normal file
59
domain/backup/restore_test.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
package backup
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// go test github.com/documize/community/domain/backup -run TestRemapORg
|
||||
func TestRemapOrg(t *testing.T) {
|
||||
r := restoreHandler{MapOrgID: make(map[string]string)}
|
||||
r.MapOrgID["abc"] = "def"
|
||||
r.MapOrgID["xyz"] = "123"
|
||||
|
||||
n := r.remapOrg("abc")
|
||||
if n != "def" {
|
||||
t.Errorf("expected def got %s", n)
|
||||
}
|
||||
|
||||
n = r.remapOrg("xyz")
|
||||
if n != "123" {
|
||||
t.Errorf("expected 123 got %s", n)
|
||||
}
|
||||
|
||||
n = r.remapOrg("jkl")
|
||||
if n != "jkl" {
|
||||
t.Errorf("expected jkl got %s", n)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemapUser(t *testing.T) {
|
||||
r := restoreHandler{MapUserID: make(map[string]string)}
|
||||
r.MapUserID["abc"] = "def"
|
||||
r.MapUserID["xyz"] = "123"
|
||||
|
||||
n := r.remapUser("abc")
|
||||
if n != "def" {
|
||||
t.Errorf("expected def got %s", n)
|
||||
}
|
||||
|
||||
n = r.remapUser("xyz")
|
||||
if n != "123" {
|
||||
t.Errorf("expected 123 got %s", n)
|
||||
}
|
||||
|
||||
n = r.remapUser("jkl")
|
||||
if n != "jkl" {
|
||||
t.Errorf("expected jkl got %s", n)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue