Skip to content

Commit

Permalink
merge B-22129
Browse files Browse the repository at this point in the history
  • Loading branch information
loganwc committed Jan 21, 2025
2 parents f2baf1e + eaeb267 commit 61be6a1
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 3 deletions.
73 changes: 73 additions & 0 deletions pkg/handlers/ghcapi/queues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1954,4 +1954,77 @@ func (suite *HandlerSuite) TestGetBulkAssignmentDataHandler() {
suite.Len(payload.AvailableOfficeUsers, 1)
suite.Len(payload.BulkAssignmentMoveIDs, 1)
})
suite.Run("returns properly formatted closeout bulk assignment data", func() {
transportationOffice := factory.BuildTransportationOffice(suite.DB(), nil, nil)

officeUser := factory.BuildOfficeUserWithPrivileges(suite.DB(), []factory.Customization{
{
Model: models.OfficeUser{
Email: "[email protected]",
Active: true,
},
},
{
Model: transportationOffice,
LinkOnly: true,
Type: &factory.TransportationOffices.CounselingOffice,
},
{
Model: models.User{
Privileges: []models.Privilege{
{
PrivilegeType: models.PrivilegeTypeSupervisor,
},
},
Roles: []roles.Role{
{
RoleType: roles.RoleTypeServicesCounselor,
},
},
},
},
}, nil)

submittedAt := time.Now()

// move to appear in the return
factory.BuildMoveWithPPMShipment(suite.DB(), []factory.Customization{
{
Model: transportationOffice,
LinkOnly: true,
Type: &factory.TransportationOffices.CloseoutOffice,
},
{
Model: models.PPMShipment{
Status: models.PPMShipmentStatusNeedsCloseout,
SubmittedAt: &submittedAt,
},
},
{
Model: models.Move{
Status: models.MoveStatusAPPROVED,
},
},
}, nil)

request := httptest.NewRequest("GET", "/queues/bulk-assignment", nil)
request = suite.AuthenticateOfficeRequest(request, officeUser)
params := queues.GetBulkAssignmentDataParams{
HTTPRequest: request,
QueueType: models.StringPointer("CLOSEOUT"),
}
handlerConfig := suite.HandlerConfig()
handler := GetBulkAssignmentDataHandler{
handlerConfig,
officeusercreator.NewOfficeUserFetcherPop(),
movefetcher.NewMoveFetcherBulkAssignment(),
}
response := handler.Handle(params)
suite.IsNotErrResponse(response)
suite.IsType(&queues.GetBulkAssignmentDataOK{}, response)
payload := response.(*queues.GetBulkAssignmentDataOK).Payload
suite.NoError(payload.Validate(strfmt.Default))
suite.Len(payload.AvailableOfficeUsers, 1)
suite.Len(payload.BulkAssignmentMoveIDs, 1)
})
}
11 changes: 8 additions & 3 deletions pkg/services/move/move_fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ func (suite *MoveServiceSuite) TestMoveFetcherBulkAssignment() {
},
}, []roles.RoleType{roles.RoleTypeServicesCounselor})

submittedAt := time.Now()

// create non USMC/USCG/NAVY ppm in need closeout status
factory.BuildMoveWithPPMShipment(suite.DB(), []factory.Customization{
{
Expand All @@ -454,7 +456,8 @@ func (suite *MoveServiceSuite) TestMoveFetcherBulkAssignment() {
},
{
Model: models.PPMShipment{
Status: models.PPMShipmentStatusNeedsCloseout,
Status: models.PPMShipmentStatusNeedsCloseout,
SubmittedAt: &submittedAt,
},
},
{
Expand All @@ -473,7 +476,8 @@ func (suite *MoveServiceSuite) TestMoveFetcherBulkAssignment() {
},
{
Model: models.PPMShipment{
Status: models.PPMShipmentStatusWaitingOnCustomer,
Status: models.PPMShipmentStatusWaitingOnCustomer,
SubmittedAt: &submittedAt,
},
},
{
Expand All @@ -497,7 +501,8 @@ func (suite *MoveServiceSuite) TestMoveFetcherBulkAssignment() {
},
{
Model: models.PPMShipment{
Status: models.PPMShipmentStatusNeedsCloseout,
Status: models.PPMShipmentStatusNeedsCloseout,
SubmittedAt: &submittedAt,
},
},
{
Expand Down

0 comments on commit 61be6a1

Please sign in to comment.