Skip to content

Commit 3172eae

Browse files
committed
Fix tests.
1 parent bc42fbf commit 3172eae

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

auth/service/api/v1/router_test.go

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var _ = Describe("Router", func() {
3434
var ctrl *gomock.Controller
3535
var svc *serviceTest.Service
3636
var userAccessor *user.MockUserAccessor
37-
var profileAccessor *user.MockUserProfileAccessor
37+
var profileAccessor *user.MockProfileAccessor
3838
var permsClient *permission.MockExtendedClient
3939

4040
BeforeEach(func() {
@@ -78,7 +78,7 @@ var _ = Describe("Router", func() {
7878
var handlerFunc rest.HandlerFunc
7979
var userID string
8080
var details request.AuthDetails
81-
var userProfile *user.UserProfile
81+
var userProfile *user.LegacyUserProfile
8282
var userDetails *user.User
8383

8484
JustBeforeEach(func() {
@@ -96,12 +96,14 @@ var _ = Describe("Router", func() {
9696
ctx = log.NewContextWithLogger(req.Context(), logTest.NewLogger())
9797
req.Request = req.WithContext(ctx)
9898

99-
userProfile = &user.UserProfile{
100-
FullName: "Some User Profile",
101-
Birthday: "2001-02-03",
102-
DiagnosisDate: "2002-03-04",
103-
About: "About me",
104-
MRN: "11223344",
99+
userProfile = &user.LegacyUserProfile{
100+
Patient: &user.LegacyPatientProfile{
101+
FullName: pointer.FromString("Some User Profile"),
102+
Birthday: "2001-02-03",
103+
DiagnosisDate: "2002-03-04",
104+
About: "About me",
105+
MRN: "11223344",
106+
},
105107
}
106108
userDetails = &user.User{
107109
UserID: pointer.FromString(userID),
@@ -165,17 +167,20 @@ var _ = Describe("Router", func() {
165167

166168
Context("other persons profile", func() {
167169
var otherPersonID string
168-
var otherProfile *user.UserProfile
170+
var otherProfile *user.LegacyUserProfile
169171
var otherDetails *user.User
170172
BeforeEach(func() {
171173
otherPersonID = userTest.RandomID()
172174
req.URL.Path = fmt.Sprintf("/v1/users/%s/profile", otherPersonID)
173-
otherProfile = &user.UserProfile{
174-
FullName: "Someone Else's Profile",
175-
Birthday: "2002-03-04",
176-
DiagnosisDate: "2003-04-05",
177-
About: "Not about me",
178-
MRN: "11223346",
175+
otherProfile = &user.LegacyUserProfile{
176+
Patient: &user.LegacyPatientProfile{
177+
178+
FullName: pointer.FromString("Someone Else's Profile"),
179+
Birthday: "2002-03-04",
180+
DiagnosisDate: "2003-04-05",
181+
About: "Not about me",
182+
MRN: "11223346",
183+
},
179184
}
180185
otherDetails = &user.User{
181186
UserID: pointer.FromString(otherPersonID),
@@ -247,7 +252,7 @@ var _ = Describe("Router", func() {
247252
Return(true, nil).AnyTimes()
248253

249254
profileAccessor.EXPECT().
250-
UpdateUserProfile(gomock.Any(), userID, updatedProfile).
255+
UpdateUserProfileV2(gomock.Any(), userID, updatedProfile).
251256
Return(nil).AnyTimes()
252257
})
253258

@@ -263,7 +268,7 @@ var _ = Describe("Router", func() {
263268
details = request.NewAuthDetails(request.MethodSessionToken, userID, authTest.NewSessionToken())
264269
req.Request = req.WithContext(request.NewContextWithAuthDetails(req.Context(), details))
265270
profileAccessor.EXPECT().
266-
UpdateUserProfile(gomock.Any(), userID, updatedProfile).
271+
UpdateUserProfileV2(gomock.Any(), userID, updatedProfile).
267272
Return(nil).AnyTimes()
268273
})
269274

auth/service/test/service.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type Service struct {
4040
confirmationClient confirmationClient.ClientWithResponsesInterface
4141
userAccessor user.UserAccessor
4242
permsClient permission.ExtendedClient
43-
profileAccessor user.UserProfileAccessor
43+
profileAccessor user.ProfileAccessor
4444
}
4545

4646
func NewService() *Service {
@@ -55,9 +55,9 @@ func NewService() *Service {
5555
// NewMockedService uses a combination of the "old" style manual stub / fakes /
5656
// mocks and newer gomocks for convenience so that the current code doesn't
5757
// have to be refactored too much
58-
func NewMockedService(ctrl *gomock.Controller) (svc *Service, userAccessor *user.MockUserAccessor, profileAccessor *user.MockUserProfileAccessor, permsClient *permission.MockExtendedClient) {
58+
func NewMockedService(ctrl *gomock.Controller) (svc *Service, userAccessor *user.MockUserAccessor, profileAccessor *user.MockProfileAccessor, permsClient *permission.MockExtendedClient) {
5959
userAccessor = user.NewMockUserAccessor(ctrl)
60-
profileAccessor = user.NewMockUserProfileAccessor(ctrl)
60+
profileAccessor = user.NewMockProfileAccessor(ctrl)
6161
permsClient = permission.NewMockExtendedClient(ctrl)
6262
return &Service{
6363
Service: serviceTest.NewService(),
@@ -144,6 +144,6 @@ func (s *Service) UserAccessor() user.UserAccessor {
144144
return s.userAccessor
145145
}
146146

147-
func (s *Service) UserProfileAccessor() user.UserProfileAccessor {
147+
func (s *Service) ProfileAccessor() user.ProfileAccessor {
148148
return s.profileAccessor
149149
}

0 commit comments

Comments
 (0)