mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-08-31 14:25:30 +00:00
added unit tests
This commit is contained in:
@@ -1402,5 +1402,21 @@ class MembershipServiceSpec
|
||||
error shouldBe a[UserNotFoundError]
|
||||
}
|
||||
}
|
||||
"get user info" should {
|
||||
"return the user info" in {
|
||||
doReturn(IO.pure(Some(okUser))).when(mockUserRepo).getUserByIdOrName(anyString)
|
||||
doReturn(IO.pure(Set(okGroup.id))).when(mockMembershipRepo).getGroupsForUser(anyString)
|
||||
val result: UserResponseInfo = underTest.getUserDetails(okUser.id, okAuth).value.unsafeRunSync().toOption.get
|
||||
result.id shouldBe okUser.id
|
||||
result.userName.get shouldBe okUser.userName
|
||||
result.groupId shouldBe Set(okGroup.id)
|
||||
}
|
||||
|
||||
"return an error if the user is not found" in {
|
||||
doReturn(IO.pure(None)).when(mockUserRepo).getUserByIdOrName(anyString)
|
||||
val error = underTest.getUserDetails("notfound", okAuth).value.unsafeRunSync().swap.toOption.get
|
||||
error shouldBe a[UserNotFoundError]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user