2016-02-20 21:05:48 +00:00
|
|
|
package rest
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/url"
|
|
|
|
"testing"
|
2023-04-20 21:02:56 +00:00
|
|
|
|
|
|
|
"github.com/restic/restic/internal/backend/test"
|
2016-02-20 21:05:48 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func parseURL(s string) *url.URL {
|
|
|
|
u, err := url.Parse(s)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return u
|
|
|
|
}
|
|
|
|
|
2023-04-20 21:02:56 +00:00
|
|
|
var configTests = []test.ConfigTestData[Config]{
|
2018-03-15 20:37:18 +00:00
|
|
|
{
|
2023-04-20 21:02:56 +00:00
|
|
|
S: "rest:http://localhost:1234",
|
|
|
|
Cfg: Config{
|
2018-03-15 20:37:18 +00:00
|
|
|
URL: parseURL("http://localhost:1234/"),
|
|
|
|
Connections: 5,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2023-04-20 21:02:56 +00:00
|
|
|
S: "rest:http://localhost:1234/",
|
|
|
|
Cfg: Config{
|
2018-03-15 20:37:18 +00:00
|
|
|
URL: parseURL("http://localhost:1234/"),
|
|
|
|
Connections: 5,
|
|
|
|
},
|
|
|
|
},
|
2016-02-20 21:05:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestParseConfig(t *testing.T) {
|
2023-04-20 21:02:56 +00:00
|
|
|
test.ParseConfigTester(t, ParseConfig, configTests)
|
2016-02-20 21:05:48 +00:00
|
|
|
}
|