Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix server tests, remove ghcimport test suite: integrationTesting #14969

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ BEGIN
RAISE WARNING ''%'', v_log_message;
ELSE
v_log_message := format(''Successfully updated moves.prime_acknowledged_at value to %s for id %s'', v_move_prime_acknowledged_at, v_move_id);
RAISE NOTICE ''%'', v_log_message;
RAISE NOTICE ''%'', v_log_message;
END IF;
END IF;
END IF;

-- Check if mtoShipments exists and is an array
IF jsonb_typeof(v_move_record->''mtoShipments'') = ''array'' THEN
Expand Down Expand Up @@ -78,7 +78,7 @@ BEGIN
RAISE WARNING ''%'', v_log_message;
ELSE
v_log_message := format(''Successfully updated mto_shipments.prime_acknowledged_at value to %s for id %s'', v_shipment_prime_acknowledged_at, v_shipment_id);
RAISE NOTICE ''%'', v_log_message;
RAISE NOTICE ''%'', v_log_message;
END IF;
END IF;
END LOOP;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Adds rejectedOn date to pre-existing rejected office users.
UPDATE office_users
SET rejected_on = updated_at
WHERE
UPDATE office_users
SET rejected_on = updated_at
WHERE
status ='REJECTED'::public."office_user_status" AND rejected_on is null;
188 changes: 0 additions & 188 deletions pkg/services/invoice/ghc_payment_request_invoice_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2004,194 +2004,6 @@ func (suite *GHCInvoiceSuite) TestFA2s() {
}
})

suite.Run("shipment with complete long line of accounting for HHG Officer with 5 TACs - B-19139 I-12630, but with a duplicate LOA present that is not a 1:1 match", func() {
// This tests that EDI 858 generation will still pass with duplicate LOAs

var loa models.LineOfAccounting
// Generate the random strings prior to looping
loaSysId := factory.MakeRandomString(20)
loaDptID := factory.MakeRandomString(2)
loaBafID := factory.MakeRandomString(4)
loaTrsySfxTx := factory.MakeRandomString(4)
loaOpAgncyID := factory.MakeRandomString(2)
loaAlltSnID := factory.MakeRandomString(4)
loaPgmElmntID := factory.MakeRandomString(8)
loaObjClsID := factory.MakeRandomString(4)
loaBdgtAcntClsNm := factory.MakeRandomString(6)
loaDocID := factory.MakeRandomString(10)
loaInstlAcntgActID := factory.MakeRandomString(6)
loaFnctPrsNm := factory.MakeRandomString(100)
loaStatCd := factory.MakeRandomString(1)
orgGrpDfasCd := factory.MakeRandomString(2)
loaTrnsnID := factory.MakeRandomString(2)

// Create duplicate LOA, but each will have different LoaDscTx so as to not "merge" together
for i := 0; i < 2; i++ {
loa = factory.BuildFullLineOfAccounting(suite.DB(), []factory.Customization{
{
Model: models.LineOfAccounting{
LoaDptID: models.StringPointer(loaDptID),
LoaBafID: models.StringPointer(loaBafID),
LoaTrsySfxTx: models.StringPointer(loaTrsySfxTx),
LoaOpAgncyID: models.StringPointer(loaOpAgncyID),
LoaAlltSnID: models.StringPointer(loaAlltSnID),
LoaPgmElmntID: models.StringPointer(loaPgmElmntID),
LoaObjClsID: models.StringPointer(loaObjClsID),
LoaBdgtAcntClsNm: models.StringPointer(loaBdgtAcntClsNm),
LoaDocID: models.StringPointer(loaDocID),
LoaInstlAcntgActID: models.StringPointer(loaInstlAcntgActID),
LoaDscTx: models.StringPointer(factory.MakeRandomString(100)),
LoaBgnDt: &sixMonthsBefore,
LoaEndDt: &sixMonthsAfter,
LoaFnctPrsNm: models.StringPointer(loaFnctPrsNm),
LoaStatCd: models.StringPointer(loaStatCd),
LoaHsGdsCd: models.StringPointer(models.LineOfAccountingHouseholdGoodsCodeOfficer),
OrgGrpDfasCd: models.StringPointer(orgGrpDfasCd),
LoaTrnsnID: models.StringPointer(loaTrnsnID),
LoaBgFyTx: &begYear,
LoaEndFyTx: &endYear,
LoaSysID: &loaSysId,
},
},
}, nil)
}
// Ensure 2 loas are created
var createdLoas []models.LineOfAccounting
err := suite.DB().All(&createdLoas)
suite.NoError(err)
suite.Len(createdLoas, 2)
// Ensure the 2 loas have matching LoaSysIds
for i := range createdLoas {
suite.Equal(loaSysId, *createdLoas[i].LoaSysID)
}
// Create 5 standalone TACs
fbmcs := []string{
"1",
"3",
"5",
"M",
"P",
}
for _, fbmc := range fbmcs {
newPointerFbmc := fbmc
factory.BuildTransportationAccountingCodeWithoutAttachedLoa(suite.DB(), []factory.Customization{
{
Model: models.TransportationAccountingCode{
TAC: *models.StringPointer("CACI"),
TacFnBlModCd: &newPointerFbmc,
TrnsprtnAcntBgnDt: &sixMonthsBefore,
TrnsprtnAcntEndDt: &sixMonthsAfter,
LoaSysID: &loaSysId,
},
},
}, nil)
}
// Setup move and payment data
move = factory.BuildMove(suite.DB(), []factory.Customization{
{
Model: models.Order{
TAC: models.StringPointer("CACI"),
IssueDate: currentTime,
},
},
}, nil)

paymentRequest = factory.BuildPaymentRequest(suite.DB(), []factory.Customization{
{
Model: move,
LinkOnly: true,
},
{
Model: models.PaymentRequest{
IsFinal: false,
Status: models.PaymentRequestStatusReviewed,
},
},
}, nil)

mtoShipment = factory.BuildMTOShipment(suite.DB(), []factory.Customization{
{
Model: move,
LinkOnly: true,
},
}, nil)

factory.BuildPaymentServiceItemWithParams(
suite.DB(),
models.ReServiceCodeDNPK,
basicPaymentServiceItemParams,
[]factory.Customization{
{
Model: move,
LinkOnly: true,
},
{
Model: mtoShipment,
LinkOnly: true,
},
{
Model: paymentRequest,
LinkOnly: true,
},
{
Model: models.PaymentServiceItem{
Status: models.PaymentServiceItemStatusApproved,
},
},
}, nil,
)

result, err := generator.Generate(suite.AppContextForTest(), paymentRequest, false)
suite.NoError(err)

concatDate := fmt.Sprintf("%d%d", begYear, endYear)
accountingInstallationNumber := fmt.Sprintf("%06s", *loa.LoaInstlAcntgActID)

fa2Assertions := []struct {
expectedDetailCode edisegment.FA2DetailCode
expectedInfoCode *string
}{
{edisegment.FA2DetailCodeTA, move.Orders.TAC},
{edisegment.FA2DetailCodeA1, loa.LoaDptID},
{edisegment.FA2DetailCodeA2, loa.LoaTnsfrDptNm},
{edisegment.FA2DetailCodeA3, &concatDate},
{edisegment.FA2DetailCodeA4, loa.LoaBafID},
{edisegment.FA2DetailCodeA5, loa.LoaTrsySfxTx},
{edisegment.FA2DetailCodeA6, loa.LoaMajClmNm},
{edisegment.FA2DetailCodeB1, loa.LoaOpAgncyID},
{edisegment.FA2DetailCodeB2, loa.LoaAlltSnID},
{edisegment.FA2DetailCodeB3, loa.LoaUic},
{edisegment.FA2DetailCodeC1, loa.LoaPgmElmntID},
{edisegment.FA2DetailCodeC2, loa.LoaTskBdgtSblnTx},
{edisegment.FA2DetailCodeD1, loa.LoaDfAgncyAlctnRcpntID},
{edisegment.FA2DetailCodeD4, loa.LoaJbOrdNm},
{edisegment.FA2DetailCodeD6, loa.LoaSbaltmtRcpntID},
{edisegment.FA2DetailCodeD7, loa.LoaWkCntrRcpntNm},
{edisegment.FA2DetailCodeE1, loa.LoaMajRmbsmtSrcID},
{edisegment.FA2DetailCodeE2, loa.LoaDtlRmbsmtSrcID},
{edisegment.FA2DetailCodeE3, loa.LoaCustNm},
{edisegment.FA2DetailCodeF1, loa.LoaObjClsID},
{edisegment.FA2DetailCodeF3, loa.LoaSrvSrcID},
{edisegment.FA2DetailCodeG2, loa.LoaSpclIntrID},
{edisegment.FA2DetailCodeI1, loa.LoaBdgtAcntClsNm},
{edisegment.FA2DetailCodeJ1, loa.LoaDocID},
{edisegment.FA2DetailCodeK6, loa.LoaClsRefID},
{edisegment.FA2DetailCodeL1, &accountingInstallationNumber},
{edisegment.FA2DetailCodeM1, loa.LoaLclInstlID},
{edisegment.FA2DetailCodeN1, loa.LoaTrnsnID},
{edisegment.FA2DetailCodeP5, loa.LoaFmsTrnsactnID},
}

suite.Len(result.ServiceItems[0].FA2s, len(fa2Assertions))
// L1 segment must be padded to a length of 6 to meet the specification
suite.Len(result.ServiceItems[0].FA2s[25].FinancialInformationCode, 6)
for i, fa2Assertion := range fa2Assertions {
fa2Segment := result.ServiceItems[0].FA2s[i]
suite.Equal(fa2Assertion.expectedDetailCode, fa2Segment.BreakdownStructureDetailCode)
suite.Equal(*fa2Assertion.expectedInfoCode, fa2Segment.FinancialInformationCode)
}
})

suite.Run("shipment with nil/blank long line of accounting (except fiscal year)", func() {
setupTestData()

Expand Down
2 changes: 1 addition & 1 deletion pkg/services/move/move_searcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (s moveSearcher) SearchMoves(appCtx appcontext.AppContext, params *services
Join("addresses as origin_addresses", "origin_addresses.id = origin_duty_locations.address_id").
Join("duty_locations as new_duty_locations", "new_duty_locations.id = orders.new_duty_location_id").
Join("addresses as new_addresses", "new_addresses.id = new_duty_locations.address_id").
LeftJoin("mto_shipments", "mto_shipments.move_id = moves.id").
LeftJoin("mto_shipments", "mto_shipments.move_id = moves.id AND mto_shipments.status <> 'DRAFT'").
LeftJoin("move_to_gbloc", "move_to_gbloc.move_id = moves.id").
GroupBy("moves.id", "service_members.id", "origin_addresses.id", "new_addresses.id").
Where("show = TRUE")
Expand Down
Loading
Loading