Skip to content

Commit

Permalink
Merge pull request #80 from Optum/fix/lease-reason-set-to-true
Browse files Browse the repository at this point in the history
Fix: resolved issue with lease not having LeaseStatusReasons populate…
  • Loading branch information
nathanagood authored Oct 28, 2019
2 parents 445f98a + 33085c3 commit a5c8649
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions pkg/provision/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func (prov *AccountProvision) ActivateAccount(create bool,
PrincipalID: principalID,
ID: leaseID.String(),
LeaseStatus: db.Active,
LeaseStatusReason: db.LeaseActive,
BudgetAmount: budgetAmount,
BudgetCurrency: budgetCurrency,
BudgetNotificationEmails: budgetNotificationEmails,
Expand Down
8 changes: 5 additions & 3 deletions pkg/provision/provisioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,10 @@ type testActivateLeaseInput struct {
func TestActivateLease(t *testing.T) {
// Construct test scenarios
lease := &db.RedboxLease{
AccountID: "123",
PrincipalID: "abc",
LeaseStatus: db.Active,
AccountID: "123",
PrincipalID: "abc",
LeaseStatus: db.Active,
LeaseStatusReason: db.LeaseActive,
}
tests := []testActivateLeaseInput{
// Happy Path - Create
Expand All @@ -221,6 +222,7 @@ func TestActivateLease(t *testing.T) {
AccountID: "123",
PrincipalID: "abc",
LeaseStatus: db.Active,
LeaseStatusReason: db.LeaseActive,
LastModifiedOn: 456,
LeaseStatusModifiedOn: 789,
},
Expand Down
3 changes: 3 additions & 0 deletions tests/acceptance/provisioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func TestProvisioner(t *testing.T) {
require.Equal(t, principalID, result.PrincipalID)
require.Equal(t, acctID, result.AccountID)
require.Equal(t, db.Active, result.LeaseStatus)
require.Equal(t, db.LeaseActive, result.LeaseStatusReason)
require.NotEqual(t, 0, result.CreatedOn)
require.NotEqual(t, 0, result.LastModifiedOn)
require.NotEqual(t, 0, result.LastModifiedOn)
Expand All @@ -73,6 +74,8 @@ func TestProvisioner(t *testing.T) {
require.Equal(t, result.AccountID, assgnAfter.AccountID)
require.Equal(t, result.LeaseStatus,
assgnAfter.LeaseStatus)
require.Equal(t, result.LeaseStatusReason,
assgnAfter.LeaseStatusReason)
require.Equal(t, result.CreatedOn, assgnAfter.CreatedOn)
require.Equal(t, result.LastModifiedOn, assgnAfter.LastModifiedOn)
require.Equal(t, result.LeaseStatusModifiedOn, assgnAfter.LeaseStatusModifiedOn)
Expand Down

0 comments on commit a5c8649

Please sign in to comment.