Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package github4s.interpreters

import java.net.URLEncoder.encode
import java.time.ZonedDateTime

import cats.syntax.all._
Expand Down Expand Up @@ -55,7 +54,7 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F]) extends Issues[F]
client.get[SearchIssuesResult](
method = "search/issues",
headers = headers,
params = Map("q" -> s"${encode(query, "utf-8")}+${searchParams.map(_.value).mkString("+")}"),
params = Map("q" -> s"$query+${searchParams.map(_.value).mkString("+")}"),
pagination
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package github4s.interpreters

import java.net.URLEncoder.encode

import cats.Functor
import cats.data.NonEmptyList
import cats.syntax.functor._
Expand Down Expand Up @@ -74,7 +72,7 @@ class RepositoriesInterpreter[F[_]: Functor](implicit
client.get[SearchReposResult](
"search/repositories",
headers,
params = Map("q" -> s"${encode(query, "utf-8")}+${searchParams.map(_.value).mkString("+")}"),
params = Map("q" -> s"$query+${searchParams.map(_.value).mkString("+")}"),
pagination
)

Expand Down
2 changes: 1 addition & 1 deletion github4s/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
</Configuration>
17 changes: 17 additions & 0 deletions github4s/src/test/scala/github4s/integration/ReposSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,23 @@ trait ReposSpec extends BaseIntegrationSpec {
response.statusCode shouldBe okStatusCode
}

it should "successfully return results when a valid repo is provided using <owner>/<name> syntax" taggedAs Integration in {
val response = clientResource
.use { client =>
Github[IO](client, accessToken).repos
.searchRepos(s"$validRepoOwner/$validRepoName", Nil)
}
.unsafeRunSync()

testIsRight[SearchReposResult](
response,
{ r =>
r.total_count > 0 shouldBe true
r.items.nonEmpty shouldBe true
}
)
}

it should "return an empty result for a non existent query string" taggedAs Integration in {
val response = clientResource
.use { client =>
Expand Down
2 changes: 1 addition & 1 deletion github4s/src/test/scala/github4s/unit/ReposSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ class ReposSpec extends BaseSpec {
"Repos.searchRepos" should "call httpClient.get with the right parameters" in {

implicit val httpClientMock: HttpClient[IO] = httpClientMockGet[SearchReposResult](
url = "search/repositories",
url = githubApiUrl,
params = Map("q" -> s"+${validSearchParams.map(_.value).mkString("+")}"),
response = IO.pure(searchReposResult)
)
Expand Down
4 changes: 2 additions & 2 deletions github4s/src/test/scala/github4s/utils/TestData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ trait TestData {
val invalidUsername = "GHInvalidUserName"
val invalidPassword = "invalidPassword"

val githubApiUrl = "http://api.github.com"
val githubApiUrl = "https://api.github.com"
val user = User(1, validUsername, githubApiUrl, githubApiUrl)
val userRepoPermission: UserRepoPermission = UserRepoPermission("admin", user)

Expand Down Expand Up @@ -89,7 +89,7 @@ trait TestData {

val validFileContent = "def hack(target: String): Option[Int] = None"

val validSearchQuery = "Scala 2.12"
val validSearchQuery = "\"/\" not accepted in SearchRepos"
val nonExistentSearchQuery = "nonExistentSearchQueryString"
val validSearchParams = List(
OwnerParamInRepository(s"$validRepoOwner/$validRepoName")
Expand Down