-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
267 additions
and
255 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,27 +73,27 @@ func TestGetEnterReferenceNumberOnTemplateError(t *testing.T) { | |
|
||
func TestPostEnterReferenceNumber(t *testing.T) { | ||
testcases := map[string]struct { | ||
shareCode sharecodedata.Data | ||
shareCode sharecodedata.Link | ||
session *sesh.LoginSession | ||
isReplacement bool | ||
isTrustCorporation bool | ||
}{ | ||
"attorney": { | ||
shareCode: sharecodedata.Data{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey("")), ActorUID: testUID}, | ||
shareCode: sharecodedata.Link{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey("")), ActorUID: testUID}, | ||
session: &sesh.LoginSession{Sub: "hey", Email: "[email protected]"}, | ||
}, | ||
"replacement": { | ||
shareCode: sharecodedata.Data{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey("")), ActorUID: testUID, IsReplacementAttorney: true}, | ||
shareCode: sharecodedata.Link{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey("")), ActorUID: testUID, IsReplacementAttorney: true}, | ||
session: &sesh.LoginSession{Sub: "hey", Email: "[email protected]"}, | ||
isReplacement: true, | ||
}, | ||
"trust corporation": { | ||
shareCode: sharecodedata.Data{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey("")), ActorUID: testUID, IsTrustCorporation: true}, | ||
shareCode: sharecodedata.Link{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey("")), ActorUID: testUID, IsTrustCorporation: true}, | ||
session: &sesh.LoginSession{Sub: "hey", Email: "[email protected]"}, | ||
isTrustCorporation: true, | ||
}, | ||
"replacement trust corporation": { | ||
shareCode: sharecodedata.Data{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey("")), ActorUID: testUID, IsReplacementAttorney: true, IsTrustCorporation: true}, | ||
shareCode: sharecodedata.Link{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey("")), ActorUID: testUID, IsReplacementAttorney: true, IsTrustCorporation: true}, | ||
session: &sesh.LoginSession{Sub: "hey", Email: "[email protected]"}, | ||
isReplacement: true, | ||
isTrustCorporation: true, | ||
|
@@ -141,7 +141,7 @@ func TestPostEnterReferenceNumber(t *testing.T) { | |
} | ||
|
||
func TestPostEnterReferenceNumberWhenConditionalCheckFailed(t *testing.T) { | ||
shareCode := sharecodedata.Data{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey("")), ActorUID: testUID} | ||
shareCode := sharecodedata.Link{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey("")), ActorUID: testUID} | ||
|
||
form := url.Values{ | ||
"reference-number": {"abcdef123456"}, | ||
|
@@ -187,7 +187,7 @@ func TestPostEnterReferenceNumberOnDonorStoreError(t *testing.T) { | |
shareCodeStore := newMockShareCodeStore(t) | ||
shareCodeStore.EXPECT(). | ||
Get(r.Context(), actor.TypeAttorney, "abcdef123456"). | ||
Return(sharecodedata.Data{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey(""))}, expectedError) | ||
Return(sharecodedata.Link{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey(""))}, expectedError) | ||
|
||
err := EnterReferenceNumber(nil, shareCodeStore, nil, nil)(testAppData, w, r) | ||
|
||
|
@@ -220,7 +220,7 @@ func TestPostEnterReferenceNumberOnShareCodeStoreNotFoundError(t *testing.T) { | |
shareCodeStore := newMockShareCodeStore(t) | ||
shareCodeStore.EXPECT(). | ||
Get(r.Context(), actor.TypeAttorney, "abcdef123456"). | ||
Return(sharecodedata.Data{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey(""))}, dynamo.NotFoundError{}) | ||
Return(sharecodedata.Link{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey(""))}, dynamo.NotFoundError{}) | ||
|
||
err := EnterReferenceNumber(template.Execute, shareCodeStore, nil, nil)(testAppData, w, r) | ||
|
||
|
@@ -242,7 +242,7 @@ func TestPostEnterReferenceNumberOnSessionGetError(t *testing.T) { | |
shareCodeStore := newMockShareCodeStore(t) | ||
shareCodeStore.EXPECT(). | ||
Get(r.Context(), actor.TypeAttorney, "abcdef123456"). | ||
Return(sharecodedata.Data{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey(""))}, nil) | ||
Return(sharecodedata.Link{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey(""))}, nil) | ||
|
||
sessionStore := newMockSessionStore(t) | ||
sessionStore.EXPECT(). | ||
|
@@ -266,7 +266,7 @@ func TestPostEnterReferenceNumberOnAttorneyStoreError(t *testing.T) { | |
shareCodeStore := newMockShareCodeStore(t) | ||
shareCodeStore.EXPECT(). | ||
Get(r.Context(), actor.TypeAttorney, "abcdef123456"). | ||
Return(sharecodedata.Data{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey(""))}, nil) | ||
Return(sharecodedata.Link{LpaKey: dynamo.LpaKey("lpa-id"), LpaOwnerKey: dynamo.LpaOwnerKey(dynamo.DonorKey(""))}, nil) | ||
|
||
attorneyStore := newMockAttorneyStore(t) | ||
attorneyStore.EXPECT(). | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
34 changes: 17 additions & 17 deletions
34
internal/attorney/attorneypage/mock_ShareCodeStore_test.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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ func TestAttorneyStoreCreate(t *testing.T) { | |
Email: "[email protected]", | ||
} | ||
|
||
shareCode := sharecodedata.Data{ | ||
shareCode := sharecodedata.Link{ | ||
PK: dynamo.ShareKey(dynamo.AttorneyShareKey("123")), | ||
SK: dynamo.ShareSortKey(dynamo.MetadataKey("123")), | ||
ActorUID: uid, | ||
|
@@ -93,7 +93,7 @@ func TestAttorneyStoreCreateWhenSessionMissing(t *testing.T) { | |
|
||
attorneyStore := &Store{dynamoClient: nil, now: nil} | ||
|
||
_, err := attorneyStore.Create(ctx, sharecodedata.Data{}, "") | ||
_, err := attorneyStore.Create(ctx, sharecodedata.Link{}, "") | ||
assert.Equal(t, appcontext.SessionMissingError{}, err) | ||
} | ||
|
||
|
@@ -109,7 +109,7 @@ func TestAttorneyStoreCreateWhenSessionMissingRequiredData(t *testing.T) { | |
|
||
attorneyStore := &Store{} | ||
|
||
_, err := attorneyStore.Create(ctx, sharecodedata.Data{}, "") | ||
_, err := attorneyStore.Create(ctx, sharecodedata.Link{}, "") | ||
assert.NotNil(t, err) | ||
}) | ||
} | ||
|
@@ -126,7 +126,7 @@ func TestAttorneyStoreCreateWhenWriteTransactionError(t *testing.T) { | |
|
||
attorneyStore := &Store{dynamoClient: dynamoClient, now: func() time.Time { return now }} | ||
|
||
_, err := attorneyStore.Create(ctx, sharecodedata.Data{ | ||
_, err := attorneyStore.Create(ctx, sharecodedata.Link{ | ||
PK: dynamo.ShareKey(dynamo.AttorneyShareKey("123")), | ||
SK: dynamo.ShareSortKey(dynamo.MetadataKey("123")), | ||
}, "") | ||
|
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
Oops, something went wrong.