2018-09-10 20:25:38 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2020-07-05 13:34:27 +00:00
|
|
|
|
2020-08-16 20:54:48 +00:00
|
|
|
"github.com/Morganamilo/go-pacmanconf"
|
2020-07-05 13:34:27 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
2020-07-08 01:22:01 +00:00
|
|
|
|
|
|
|
"github.com/Jguer/yay/v10/pkg/settings"
|
2018-09-10 20:25:38 +00:00
|
|
|
)
|
|
|
|
|
2020-08-16 20:54:48 +00:00
|
|
|
func TestPacmanConf(t *testing.T) {
|
2020-08-21 00:39:52 +00:00
|
|
|
expectedPacmanConf := &pacmanconf.Config{
|
|
|
|
RootDir: "/",
|
2020-08-16 20:54:48 +00:00
|
|
|
DBPath: "//var/lib/pacman/",
|
|
|
|
CacheDir: []string{"/cachedir/", "/another/"},
|
|
|
|
HookDir: []string{"/hookdir/"},
|
|
|
|
GPGDir: "/gpgdir/",
|
|
|
|
LogFile: "/logfile",
|
|
|
|
HoldPkg: []string(nil),
|
|
|
|
IgnorePkg: []string{"ignore", "this", "package"},
|
|
|
|
IgnoreGroup: []string{"ignore", "this", "group"},
|
|
|
|
Architecture: "8086",
|
|
|
|
XferCommand: "",
|
|
|
|
NoUpgrade: []string{"noupgrade"},
|
|
|
|
NoExtract: []string{"noextract"},
|
|
|
|
CleanMethod: []string{"KeepInstalled"},
|
|
|
|
SigLevel: []string{"PackageOptional", "PackageTrustedOnly", "DatabaseOptional", "DatabaseTrustedOnly"},
|
|
|
|
LocalFileSigLevel: []string(nil),
|
|
|
|
RemoteFileSigLevel: []string(nil),
|
|
|
|
UseSyslog: false,
|
|
|
|
Color: false,
|
|
|
|
UseDelta: 0,
|
|
|
|
TotalDownload: true,
|
|
|
|
CheckSpace: true,
|
|
|
|
VerbosePkgLists: true,
|
|
|
|
DisableDownloadTimeout: false,
|
|
|
|
Repos: []pacmanconf.Repository{
|
|
|
|
{Name: "repo1", Servers: []string{"repo1"}, SigLevel: []string(nil), Usage: []string{"All"}},
|
2020-08-21 00:39:52 +00:00
|
|
|
{Name: "repo2", Servers: []string{"repo2"}, SigLevel: []string(nil), Usage: []string{"All"}},
|
|
|
|
},
|
|
|
|
}
|
2020-08-16 20:54:48 +00:00
|
|
|
|
2020-08-08 16:43:37 +00:00
|
|
|
pacmanConf, color, err := initAlpm(settings.MakeArguments(), "testdata/pacman.conf")
|
2020-07-05 13:34:27 +00:00
|
|
|
assert.Nil(t, err)
|
|
|
|
assert.NotNil(t, pacmanConf)
|
2020-08-08 16:43:37 +00:00
|
|
|
assert.Equal(t, color, false)
|
2020-08-16 20:54:48 +00:00
|
|
|
assert.EqualValues(t, expectedPacmanConf, pacmanConf)
|
2018-09-10 20:25:38 +00:00
|
|
|
}
|