-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PFS-130 upload moto card payments report (#16)
* PFS-143 Create back-end structure similar to finance-hub * PFS-143 Create back-end structure similar to finance-hub * PFS-143 Add test upload file code * PFS-143 Update makefile and build yml * PFS-143 Fix linting * PFS-143 Add localstack for local bucket * PFS-143 Upload file from form * PFS-143 Fix linting * PFS-143 Add SSE to upload * PFS-143 Add success message, remove test upload type * PFS-143 Migrate to aws-sdk-go-v2 * PFS-143 Attempt to fix blank endpoint * PFS-143 Attempt to fix blank endpoint * PFS-143 Undo previous change * PFS-143 Move uploads to subfolder in bucket * PFS-143 Move CSV header validation to back-end * PFS-143 Add cypress test & api unit tests * PFS-143 Create ADR * PFS-143 Fix build * PFS-143 Code cleanup, move upload type enum to shared * PFS-143 Change case of upload type enum, undo SSE env var * PFS-143 Fix cypress test * PFS-143 Fix cypress test * PFS-130 Change directory for testing * PFS-130 Add s3 directory to enum * PFS-130 Add MOTO card upload type headers * PFS-130 Add MOTO card filename validation * PFS-130 Remove validation for other reports * PFS-130 Update SSE algorithm to use KMS * PFS-130 Add error catching to upload type filename & add tests
- Loading branch information
1 parent
221b402
commit b70c86d
Showing
5 changed files
with
95 additions
and
5 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package shared | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestReportUploadType_Filename(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
uploadType ReportUploadType | ||
dateString string | ||
wantErr bool | ||
wantFilename string | ||
}{ | ||
{ | ||
name: "Non-moto card payments report type", | ||
uploadType: ReportTypeUploadDeputySchedule, | ||
dateString: "02/01/2020", | ||
wantErr: false, | ||
wantFilename: "", | ||
}, | ||
{ | ||
name: "Moto card payments report type", | ||
uploadType: ReportTypeUploadPaymentsMOTOCard, | ||
dateString: "02/01/2020", | ||
wantErr: false, | ||
wantFilename: "", | ||
}, | ||
{ | ||
name: "Invalid date", | ||
uploadType: ReportTypeUploadPaymentsMOTOCard, | ||
dateString: "hehe", | ||
wantErr: true, | ||
wantFilename: "", | ||
}, | ||
} | ||
for _, test := range tests { | ||
t.Run(test.name, func(t *testing.T) { | ||
filename, err := test.uploadType.Filename(test.dateString) | ||
|
||
assert.Equal(t, test.wantFilename, filename) | ||
|
||
if test.wantErr { | ||
assert.Error(t, err) | ||
} | ||
}) | ||
} | ||
} |