-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
Users.scala
/**
* Lists the people following the specified user.
*
* @param username of the user to retrieve
* @param pagination Limit and Offset for pagination
* @param headers optional user headers to include in the request
* @return GHResponse[List[User]\] User details
*/
def getFollowers(
username: String,
pagination: Option[Pagination] = None,
headers: Map[String, String] = Map()
): F[GHResponse[List[User]]]UsersInterpreter.scala
override def getFollowers(
username: String,
pagination: Option[Pagination],
headers: Map[String, String]
): F[GHResponse[List[User]]] =
client
.get[List[User]](s"users/$username/followers", headers, pagination = pagination)UsersSpec.scala
"Users >> GetFollowers" should "return the expected followers list for a valid username" taggedAs Integration in {
val response = clientResource
.use { client =>
Github[IO](client, accessToken).users
.getFollowers(validUsername, None, headerUserAgent)
}
.unsafeRunSync()
testIsRight[List[User]](response, r => r.nonEmpty shouldBe true)
response.statusCode shouldBe okStatusCode
}
it should "return error on Left for invalid username" taggedAs Integration in {
val response = clientResource
.use { client =>
Github[IO](client, accessToken).users
.getFollowers(invalidUsername, None, headerUserAgent)
}
.unsafeRunSync()
testIsLeft[GHError.NotFoundError, List[User]](response)
response.statusCode shouldBe notFoundStatusCode
}Metadata
Metadata
Assignees
Labels
No labels