mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
add backup/restore REST API
This commit is contained in:
@@ -176,19 +176,27 @@ func TestApiCallsWithBadURL(t *testing.T) {
|
||||
u := dataprovider.User{}
|
||||
_, _, err := UpdateUser(u, http.StatusBadRequest)
|
||||
if err == nil {
|
||||
t.Errorf("request with invalid URL must fail")
|
||||
t.Error("request with invalid URL must fail")
|
||||
}
|
||||
_, err = RemoveUser(u, http.StatusNotFound)
|
||||
if err == nil {
|
||||
t.Errorf("request with invalid URL must fail")
|
||||
t.Error("request with invalid URL must fail")
|
||||
}
|
||||
_, _, err = GetUsers(1, 0, "", http.StatusBadRequest)
|
||||
if err == nil {
|
||||
t.Errorf("request with invalid URL must fail")
|
||||
t.Error("request with invalid URL must fail")
|
||||
}
|
||||
_, err = CloseConnection("non_existent_id", http.StatusNotFound)
|
||||
if err == nil {
|
||||
t.Errorf("request with invalid URL must fail")
|
||||
t.Error("request with invalid URL must fail")
|
||||
}
|
||||
_, _, err = Dumpdata("backup.json", http.StatusBadRequest)
|
||||
if err == nil {
|
||||
t.Error("request with invalid URL must fail")
|
||||
}
|
||||
_, _, err = Loaddata("/tmp/backup.json", "", http.StatusBadRequest)
|
||||
if err == nil {
|
||||
t.Error("request with invalid URL must fail")
|
||||
}
|
||||
SetBaseURL(oldBaseURL)
|
||||
}
|
||||
@@ -241,6 +249,14 @@ func TestApiCallToNotListeningServer(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Errorf("request to an inactive URL must fail")
|
||||
}
|
||||
_, _, err = Dumpdata("backup.json", http.StatusOK)
|
||||
if err == nil {
|
||||
t.Errorf("request to an inactive URL must fail")
|
||||
}
|
||||
_, _, err = Loaddata("/tmp/backup.json", "", http.StatusOK)
|
||||
if err == nil {
|
||||
t.Errorf("request to an inactive URL must fail")
|
||||
}
|
||||
SetBaseURL(oldBaseURL)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user