예제 #1
0
func mustGetTestService(opts ...geoip.Option) *geoip.Service {
	maxMindDB := filepath.Join(build.Default.GOPATH, "src", "github.com", "corestoreio", "csfw", "net", "geoip", "GeoIP2-Country-Test.mmdb")
	s, err := geoip.NewService(append(opts, geoip.WithGeoIP2Reader(maxMindDB))...)
	if err != nil {
		panic(err)
	}
	return s
}
예제 #2
0
func TestNewServiceErrorWithGeoIP2Reader(t *testing.T) {
	s, err := geoip.NewService(geoip.WithGeoIP2Reader("Walhalla/GeoIP2-Country-Test.mmdb"))
	assert.Nil(t, s)
	assert.EqualError(t, err, "File Walhalla/GeoIP2-Country-Test.mmdb not found")
}