6a9ae32012
This splits config.go into ui.go for the user interface functions and authorize.go for the implementation of `rclone authorize`. It also moves the tests into the correct places (including one from obscure which was in the wrong place).
29 lines
607 B
Go
29 lines
607 B
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestMatchProvider(t *testing.T) {
|
|
for _, test := range []struct {
|
|
config string
|
|
provider string
|
|
want bool
|
|
}{
|
|
{"", "", true},
|
|
{"one", "one", true},
|
|
{"one,two", "two", true},
|
|
{"one,two,three", "two", true},
|
|
{"one", "on", false},
|
|
{"one,two,three", "tw", false},
|
|
{"!one,two,three", "two", false},
|
|
{"!one,two,three", "four", true},
|
|
} {
|
|
what := fmt.Sprintf("%q,%q", test.config, test.provider)
|
|
got := matchProvider(test.config, test.provider)
|
|
assert.Equal(t, test.want, got, what)
|
|
}
|
|
}
|