Skip to content

Commit

Permalink
test: test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
kmigielek committed Jan 13, 2024
1 parent aded4b4 commit 253a753
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 9 deletions.
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/apimatic/go-core-runtime v0.0.13 h1:KBrOoUbgdIYbjH+TrQNXkbK7QGBovdX43wr7q5Ta6yE=
github.com/apimatic/go-core-runtime v0.0.13/go.mod h1:kyqGg2v3OTV7o2fXHgbHLZPMinqZvIqw1JwdEd64OzM=
38 changes: 31 additions & 7 deletions test/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,39 @@ package test
import (
"testing"

maxioadvancedbilling "github.com/maxio-com/ab-golang-sdk"
"github.com/caarlos0/env/v10"
advancedbilling "github.com/maxio-com/ab-golang-sdk"
"github.com/stretchr/testify/suite"
)

func TestExample(t *testing.T) {
// test suite debilu
config := maxioadvancedbilling.CreateConfiguration(
maxioadvancedbilling.WithBasicAuthUserName("BasicAuthUserName"),
maxioadvancedbilling.WithBasicAuthPassword("BasicAuthPassword"),
type Config struct {
APIKey string `env:"API_KEY"`
Password string `env:"API_PASSWORD"`
Domain string `env:"DOMAIN"`
Subdomain string `env:"SUBDOMAIN"`
}

type APITestSuite struct {
suite.Suite
client advancedbilling.ClientInterface
}

func (s *APITestSuite) SetupTest() {
cfg := Config{}
if err := env.Parse(&cfg); err != nil {
s.T().Fatalf("could not load config: %s", err)
}

config := advancedbilling.CreateConfiguration(
advancedbilling.WithBasicAuthUserName(cfg.APIKey),
advancedbilling.WithBasicAuthPassword(cfg.Password),
advancedbilling.WithDomain(cfg.Domain),
advancedbilling.WithSubdomain(cfg.Subdomain),
)

t.Log(config)
s.client = advancedbilling.NewClient(config)
}

func (s *APITestSuite) TestExample(t *testing.T) {
t.Log(s.client.Configuration().Domain())
}
13 changes: 11 additions & 2 deletions test/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@ module github.com/maxio-com/ab-golang-sdk/test

go 1.21

require github.com/apimatic/go-core-runtime v0.0.13 // indirect
require (
github.com/apimatic/go-core-runtime v0.0.13 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

require github.com/maxio-com/ab-golang-sdk v0.0.1
require (
github.com/caarlos0/env/v10 v10.0.0
github.com/maxio-com/ab-golang-sdk v0.0.1
github.com/stretchr/testify v1.8.4
)

replace github.com/maxio-com/ab-golang-sdk => ../
12 changes: 12 additions & 0 deletions test/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
github.com/apimatic/go-core-runtime v0.0.13 h1:KBrOoUbgdIYbjH+TrQNXkbK7QGBovdX43wr7q5Ta6yE=
github.com/apimatic/go-core-runtime v0.0.13/go.mod h1:kyqGg2v3OTV7o2fXHgbHLZPMinqZvIqw1JwdEd64OzM=
github.com/caarlos0/env/v10 v10.0.0 h1:yIHUBZGsyqCnpTkbjk8asUlx6RFhhEs+h7TOBdgdzXA=
github.com/caarlos0/env/v10 v10.0.0/go.mod h1:ZfulV76NvVPw3tm591U4SwL3Xx9ldzBP9aGxzeN7G18=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 comments on commit 253a753

Please sign in to comment.