Skip to content

Commit

Permalink
Resource Tested for JSON marshalling : MarketplacePlanAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
sagar23sj committed Jun 27, 2021
1 parent 29bdfa3 commit b9028f0
Showing 1 changed file with 108 additions and 0 deletions.
108 changes: 108 additions & 0 deletions github/apps_marketplace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,3 +375,111 @@ func TestMarketplacePendingChange_Marshal(t *testing.T) {

testJSONMarshal(t, u, want)
}

func TestMarketplacePlanAccount_Marshal(t *testing.T) {
testJSONMarshal(t, &MarketplacePlanAccount{}, "{}")

u := &MarketplacePlanAccount{
URL: String("u"),
Type: String("t"),
ID: Int64(1),
Login: String("l"),
OrganizationBillingEmail: String("obe"),
MarketplacePurchase: &MarketplacePurchase{
BillingCycle: String("bc"),
NextBillingDate: &Timestamp{referenceTime},
UnitCount: Int(1),
Plan: &MarketplacePlan{
URL: String("u"),
AccountsURL: String("au"),
ID: Int64(1),
Number: Int(1),
Name: String("n"),
Description: String("d"),
MonthlyPriceInCents: Int(1),
YearlyPriceInCents: Int(1),
PriceModel: String("pm"),
UnitName: String("un"),
Bullets: &[]string{"b"},
State: String("s"),
HasFreeTrial: Bool(false),
},
OnFreeTrial: Bool(false),
FreeTrialEndsOn: &Timestamp{referenceTime},
UpdatedAt: &Timestamp{referenceTime},
},
MarketplacePendingChange: &MarketplacePendingChange{
EffectiveDate: &Timestamp{referenceTime},
UnitCount: Int(1),
ID: Int64(1),
Plan: &MarketplacePlan{
URL: String("u"),
AccountsURL: String("au"),
ID: Int64(1),
Number: Int(1),
Name: String("n"),
Description: String("d"),
MonthlyPriceInCents: Int(1),
YearlyPriceInCents: Int(1),
PriceModel: String("pm"),
UnitName: String("un"),
Bullets: &[]string{"b"},
State: String("s"),
HasFreeTrial: Bool(false),
},
},
}

want := `{
"url": "u",
"type": "t",
"id": 1,
"login": "l",
"organization_billing_email": "obe",
"marketplace_purchase": {
"billing_cycle": "bc",
"next_billing_date": ` + referenceTimeStr + `,
"unit_count": 1,
"plan": {
"url": "u",
"accounts_url": "au",
"id": 1,
"number": 1,
"name": "n",
"description": "d",
"monthly_price_in_cents": 1,
"yearly_price_in_cents": 1,
"price_model": "pm",
"unit_name": "un",
"bullets": ["b"],
"state": "s",
"has_free_trial": false
},
"on_free_trial": false,
"free_trial_ends_on": ` + referenceTimeStr + `,
"updated_at": ` + referenceTimeStr + `
},
"marketplace_pending_change": {
"effective_date": ` + referenceTimeStr + `,
"unit_count": 1,
"id": 1,
"plan": {
"url": "u",
"accounts_url": "au",
"id": 1,
"number": 1,
"name": "n",
"description": "d",
"monthly_price_in_cents": 1,
"yearly_price_in_cents": 1,
"price_model": "pm",
"unit_name": "un",
"bullets": ["b"],
"state": "s",
"has_free_trial": false
}
}
}`

testJSONMarshal(t, u, want)
}

0 comments on commit b9028f0

Please sign in to comment.