Skip to content

Commit

Permalink
[DE-1091] Fix tests after sdk update
Browse files Browse the repository at this point in the history
  • Loading branch information
maciej-nedza committed Dec 13, 2024
1 parent e89145f commit 0a6b6ef
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
env:
TEST_API_KEY: ${{secrets.TEST_API_KEY}}
TEST_API_PASSWORD: ${{secrets.TEST_API_PASSWORD}}
TEST_DOMAIN: ${{vars.TEST_DOMAIN}}
TEST_SUBDOMAIN: ${{vars.TEST_SUBDOMAIN}}

jobs:
Expand Down
8 changes: 1 addition & 7 deletions test/component_allocations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,7 @@ func (s *ComponentAlocationSuite) TestComponentAllocations() {
},
},
},
UnitPrice: models.ToPointer(models.OnOffComponentUnitPriceContainer.FromString("100")),
Prices: []models.Price{
{
StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(1),
UnitPrice: models.PriceUnitPriceContainer.FromPrecision(1),
},
},
UnitPrice: models.OnOffComponentUnitPriceContainer.FromString("100"),
},
},
)
Expand Down
15 changes: 6 additions & 9 deletions test/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
type Config struct {
APIKey string `env:"TEST_API_KEY,required"`
Password string `env:"TEST_API_PASSWORD,required"`
Domain string `env:"TEST_DOMAIN,required"`
Subdomain string `env:"TEST_SUBDOMAIN,required"`
}

Expand Down Expand Up @@ -63,8 +62,7 @@ func (s *APISuite) SetupTest() {
cfg.Password,
),
),
advancedbilling.WithDomain(cfg.Domain),
advancedbilling.WithSubdomain(cfg.Subdomain),
advancedbilling.WithSite(cfg.Subdomain),
)

configUnauthorized := advancedbilling.CreateConfiguration(
Expand All @@ -74,8 +72,7 @@ func (s *APISuite) SetupTest() {
"abc",
),
),
advancedbilling.WithDomain(cfg.Domain),
advancedbilling.WithSubdomain(cfg.Subdomain),
advancedbilling.WithSite(cfg.Subdomain),
)

s.client = advancedbilling.NewClient(config)
Expand Down Expand Up @@ -153,11 +150,11 @@ func (s *APISuite) generateProduct(ctx context.Context, productFamilyID int) mod
}

func (s *APISuite) generateCoupon(ctx context.Context, productFamilyID int) models.Coupon {
coupon := &models.CreateOrUpdatePercentageCoupon{
coupon := &models.CouponPayload{
Name: s.fkr.RandomStringWithLength(20),
Code: "100OFF" + s.fkr.RandomStringWithLength(30),
Description: strPtr(s.fkr.RandomStringWithLength(20)),
Percentage: models.CreateOrUpdatePercentageCouponPercentageContainer.FromString("50"),
Percentage: models.CouponPayloadPercentage.FromString("50"),
AllowNegativeBalance: boolPtr(false),
Recurring: boolPtr(false),
EndDate: timePtr(time.Now().AddDate(1, 0, 0)),
Expand All @@ -167,8 +164,8 @@ func (s *APISuite) generateCoupon(ctx context.Context, productFamilyID int) mode
ApplyOnCancelAtEndOfPeriod: boolPtr(true),
}

resp, err := s.client.CouponsController().CreateCoupon(ctx, productFamilyID, &models.CreateOrUpdateCoupon{
Coupon: models.ToPointer(models.CreateOrUpdateCouponCouponContainer.FromCreateOrUpdatePercentageCoupon(*coupon)),
resp, err := s.client.CouponsController().CreateCoupon(ctx, productFamilyID, &models.CouponRequest{
Coupon: models.ToPointer(*coupon),
})

s.NoError(err)
Expand Down

0 comments on commit 0a6b6ef

Please sign in to comment.