-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmagento1_test.go
44 lines (37 loc) · 1.13 KB
/
magento1_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package gocommerce
import (
"testing"
"github.com/stretchr/testify/assert"
)
var m1store = Magento1{
basePlatform{
"Magento 1",
"app/etc/local.xml",
"app/etc/local.xml",
},
"n98-magerun2",
}
func TestM1Configs(t *testing.T) {
tests := []struct{ path, want, slug string }{
{"local.xml", "app:sdkjfhjksdfjk@tcp(localhost:3306)/mag1?allowOldPasswords=true", "s3cr3tfrontname"},
{"local.xml.hostport", "app:werrrwww@tcp(localhost:3307)/mag1?allowOldPasswords=true", "willem"},
{"local.xml.nopass", "userhere:@tcp(db:3306)/dbnamehere?allowOldPasswords=true", "admin"},
}
for _, test := range tests {
src := fixtureBase + "magento1/app/etc/" + test.path
cfg, err := m1store.ParseConfig(src)
assert.NoError(t, err)
assert.Equal(t, test.want, cfg.DB.DSN())
assert.Equal(t, test.slug, cfg.AdminSlug)
}
}
func TestM1BogusConfig(t *testing.T) {
cfg, err := m1store.ParseConfig(fixtureBase + "magento1/app/etc/local.xml.bogus")
assert.Error(t, err)
assert.Nil(t, cfg)
}
func TestM1Version(t *testing.T) {
version, err := m1store.Version(fixtureBase + "magento1")
assert.Nil(t, err)
assert.Equal(t, "1.9.4.5", version)
}