Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ds-mb-8798-react-file-viewer-update-fix-de…
…precation-msg
- Loading branch information
Showing
23 changed files
with
344 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
migrations/app/schema/20210720183133_create_rds_pgaudit_role.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- Assume the master role, which has the ability to create roles. | ||
SET ROLE master; | ||
|
||
-- Create a new role named "rds_pgaudit" as indicated by the AWS documentation: | ||
-- https://aws.amazon.com/premiumsupport/knowledge-center/rds-postgresql-pgaudit/ | ||
-- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.html#Appendix.PostgreSQL.CommonDBATasks.pgaudit | ||
CREATE ROLE rds_pgaudit; |
2 changes: 2 additions & 0 deletions
2
migrations/app/schema/20210721192603_remove_erin_cac_certs.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Remove erin CAC using unique sha256 digest of client cert | ||
DELETE FROM client_certs WHERE sha256_digest='d72d8acfa6c5e8e6aa036f69a817a000db8387dfa5ed4397d1aa636b82949330'; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
pkg/gen/primemessages/m_t_o_service_item_domestic_crating.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
pkg/handlers/primeapi/payloads/payload_to_model_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
package payloads | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/gofrs/uuid" | ||
|
||
"github.com/transcom/mymove/pkg/gen/primemessages" | ||
"github.com/transcom/mymove/pkg/handlers" | ||
"github.com/transcom/mymove/pkg/models" | ||
"github.com/transcom/mymove/pkg/unit" | ||
) | ||
|
||
func (suite *PayloadsSuite) TestMTOServiceItemModel() { | ||
moveTaskOrderIDField, _ := uuid.NewV4() | ||
mtoShipmentIDField, _ := uuid.NewV4() | ||
mtoShipmentIDString := handlers.FmtUUID(mtoShipmentIDField) | ||
|
||
// Basic Service Item | ||
basicServieItem := &primemessages.MTOServiceItemBasic{ | ||
ReServiceCode: "FSC", | ||
} | ||
|
||
basicServieItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) | ||
basicServieItem.SetMtoShipmentID(*mtoShipmentIDString) | ||
|
||
// DCRT Service Item | ||
itemMeasurement := int32(1100) | ||
crateMeasurement := int32(1200) | ||
dcrtCode := "DCRT" | ||
reason := "Reason" | ||
description := "Description" | ||
|
||
item := &primemessages.MTOServiceItemDimension{ | ||
Height: &itemMeasurement, | ||
Width: &itemMeasurement, | ||
Length: &itemMeasurement, | ||
} | ||
|
||
crate := &primemessages.MTOServiceItemDimension{ | ||
Height: &crateMeasurement, | ||
Width: &crateMeasurement, | ||
Length: &crateMeasurement, | ||
} | ||
|
||
DCRTServiceItem := &primemessages.MTOServiceItemDomesticCrating{ | ||
ReServiceCode: &dcrtCode, | ||
Reason: &reason, | ||
Description: &description, | ||
Item: item, | ||
Crate: crate, | ||
} | ||
|
||
DCRTServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) | ||
DCRTServiceItem.SetMtoShipmentID(*mtoShipmentIDString) | ||
|
||
suite.T().Run("Success - Returns a basic service item model", func(t *testing.T) { | ||
returnedModel, verrs := MTOServiceItemModel(basicServieItem) | ||
|
||
suite.NoVerrs(verrs) | ||
suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) | ||
suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) | ||
suite.Equal(models.ReServiceCode("FSC"), returnedModel.ReService.Code) | ||
}) | ||
|
||
suite.T().Run("Success - Returns a DCRT service item model", func(t *testing.T) { | ||
returnedModel, verrs := MTOServiceItemModel(DCRTServiceItem) | ||
|
||
var returnedItem, returnedCrate models.MTOServiceItemDimension | ||
for _, dimension := range returnedModel.Dimensions { | ||
if dimension.Type == models.DimensionTypeItem { | ||
returnedItem = dimension | ||
} else { | ||
returnedCrate = dimension | ||
} | ||
} | ||
|
||
suite.NoVerrs(verrs) | ||
suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) | ||
suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) | ||
suite.Equal(models.ReServiceCode("DCRT"), returnedModel.ReService.Code) | ||
suite.Equal(DCRTServiceItem.Reason, returnedModel.Reason) | ||
suite.Equal(DCRTServiceItem.Description, returnedModel.Description) | ||
suite.Equal(unit.ThousandthInches(*DCRTServiceItem.Item.Length), returnedItem.Length) | ||
suite.Equal(unit.ThousandthInches(*DCRTServiceItem.Crate.Length), returnedCrate.Length) | ||
}) | ||
|
||
suite.T().Run("Fail - Returns error for DCRT service item because of validation error", func(t *testing.T) { | ||
badCrateMeasurement := int32(200) | ||
badCrate := &primemessages.MTOServiceItemDimension{ | ||
Height: &badCrateMeasurement, | ||
Width: &badCrateMeasurement, | ||
Length: &badCrateMeasurement, | ||
} | ||
|
||
badDCRTServiceItem := &primemessages.MTOServiceItemDomesticCrating{ | ||
ReServiceCode: &dcrtCode, | ||
Reason: &reason, | ||
Description: &description, | ||
Item: item, | ||
Crate: badCrate, | ||
} | ||
|
||
badDCRTServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) | ||
badDCRTServiceItem.SetMtoShipmentID(*mtoShipmentIDString) | ||
|
||
returnedModel, verrs := MTOServiceItemModel(badDCRTServiceItem) | ||
|
||
suite.True(verrs.HasAny(), "invalid crate dimensions for DCRT service item") | ||
suite.Nil(returnedModel, "returned a model when erroring") | ||
|
||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package payloads | ||
|
||
import ( | ||
"log" | ||
"testing" | ||
|
||
"github.com/transcom/mymove/pkg/testingsuite" | ||
|
||
"github.com/stretchr/testify/suite" | ||
"go.uber.org/zap" | ||
|
||
"github.com/transcom/mymove/pkg/handlers" | ||
"github.com/transcom/mymove/pkg/notifications" | ||
) | ||
|
||
// HandlerSuite is an abstraction of our original suite | ||
type PayloadsSuite struct { | ||
handlers.BaseHandlerTestSuite | ||
} | ||
|
||
// TestHandlerSuite creates our test suite | ||
func TestHandlerSuite(t *testing.T) { | ||
logger, err := zap.NewDevelopment() | ||
if err != nil { | ||
log.Panic(err) | ||
} | ||
|
||
hs := &PayloadsSuite{ | ||
BaseHandlerTestSuite: handlers.NewBaseHandlerTestSuite(logger, notifications.NewStubNotificationSender("milmovelocal", logger), testingsuite.CurrentPackage()), | ||
} | ||
|
||
suite.Run(t, hs) | ||
hs.PopTestSuite.TearDown() | ||
} |
Oops, something went wrong.