diff --git a/src/test/scala/org/broadinstitute/dsde/workbench/sam/dataAccess/StatefulMockDirectoryDaoBuilder.scala b/src/test/scala/org/broadinstitute/dsde/workbench/sam/dataAccess/StatefulMockDirectoryDaoBuilder.scala index 923605c9f..f133d347a 100644 --- a/src/test/scala/org/broadinstitute/dsde/workbench/sam/dataAccess/StatefulMockDirectoryDaoBuilder.scala +++ b/src/test/scala/org/broadinstitute/dsde/workbench/sam/dataAccess/StatefulMockDirectoryDaoBuilder.scala @@ -4,7 +4,7 @@ import cats.effect.IO import cats.effect.unsafe.implicits.global import org.broadinstitute.dsde.workbench.model._ import org.broadinstitute.dsde.workbench.sam.model.BasicWorkbenchGroup -import org.broadinstitute.dsde.workbench.sam.model.api.SamUser +import org.broadinstitute.dsde.workbench.sam.model.api.{SamUser, SamUserAttributes} import org.broadinstitute.dsde.workbench.sam.util.SamRequestContext import org.mockito.ArgumentMatchers import org.mockito.IdiomaticMockito.StubbingOps @@ -129,6 +129,11 @@ case class StatefulMockDirectoryDaoBuilder() extends MockitoSugar { .when(mockedDirectoryDAO) .deleteUser(any[WorkbenchUserId], any[SamRequestContext]) + lenient() + .doReturn(IO.unit) + .when(mockedDirectoryDAO) + .setUserAttributes(any[SamUserAttributes], any[SamRequestContext]) + def withExistingUser(samUser: SamUser): StatefulMockDirectoryDaoBuilder = withExistingUsers(Set(samUser)) def withExistingUsers(samUsers: Iterable[SamUser]): StatefulMockDirectoryDaoBuilder = { samUsers.toSet.foreach(makeUserExist) diff --git a/src/test/scala/org/broadinstitute/dsde/workbench/sam/service/MockUserServiceBuilder.scala b/src/test/scala/org/broadinstitute/dsde/workbench/sam/service/MockUserServiceBuilder.scala index 3e65e4b10..a7fc021f3 100644 --- a/src/test/scala/org/broadinstitute/dsde/workbench/sam/service/MockUserServiceBuilder.scala +++ b/src/test/scala/org/broadinstitute/dsde/workbench/sam/service/MockUserServiceBuilder.scala @@ -80,6 +80,7 @@ case class MockUserServiceBuilder() extends IdiomaticMockito { mockUserService.getUserAllowances(any[SamUser], any[SamRequestContext]) returns IO( SamUserAllowances(allowed = false, enabled = false, termsOfService = false) ) + mockUserService.getUserAttributes(any[WorkbenchUserId], any[SamRequestContext]) returns IO(None) } private def makeUser(samUser: SamUser, mockUserService: UserService): Unit = { diff --git a/src/test/scala/org/broadinstitute/dsde/workbench/sam/service/UserServiceSpec.scala b/src/test/scala/org/broadinstitute/dsde/workbench/sam/service/UserServiceSpec.scala index 5040270c5..3ff406fd0 100644 --- a/src/test/scala/org/broadinstitute/dsde/workbench/sam/service/UserServiceSpec.scala +++ b/src/test/scala/org/broadinstitute/dsde/workbench/sam/service/UserServiceSpec.scala @@ -14,7 +14,7 @@ import org.broadinstitute.dsde.workbench.sam.google.GoogleExtensions import org.broadinstitute.dsde.workbench.sam.matchers.BeSameUserMatcher.beSameUserAs import org.broadinstitute.dsde.workbench.sam.matchers.TimeMatchers import org.broadinstitute.dsde.workbench.sam.model._ -import org.broadinstitute.dsde.workbench.sam.model.api.SamUser +import org.broadinstitute.dsde.workbench.sam.model.api.{SamUser, SamUserAttributes} import org.broadinstitute.dsde.workbench.sam.service.UserServiceSpecs.{CreateUserSpec, GetUserStatusSpec, InviteUserSpec} import org.broadinstitute.dsde.workbench.sam.util.SamRequestContext import org.mockito.Mockito @@ -123,6 +123,7 @@ class OldUserServiceMockSpec(_system: ActorSystem) when(dirDAO.listUserDirectMemberships(defaultUser.id, samRequestContext)).thenReturn(IO(LazyList(allUsersGroup.id))) when(dirDAO.setGoogleSubjectId(defaultUser.id, defaultUser.googleSubjectId.get, samRequestContext)).thenReturn(IO(())) when(dirDAO.setUserAzureB2CId(defaultUser.id, defaultUser.azureB2CId.get, samRequestContext)).thenReturn(IO(())) + when(dirDAO.setUserAttributes(any[SamUserAttributes], any[SamRequestContext])).thenReturn(IO(())) googleExtensions = mock[GoogleExtensions](RETURNS_SMART_NULLS) when(googleExtensions.getOrCreateAllUsersGroup(any[DirectoryDAO], any[SamRequestContext])(any[ExecutionContext]))