Skip to content

Commit

Permalink
Migrate unicode arrows, fixes #304 (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
duanebester authored and BenFradet committed Dec 12, 2019
1 parent bb8c9a2 commit f0a4ada
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 41 deletions.
6 changes: 3 additions & 3 deletions github4s/jvm/src/test/scala/github4s/unit/ApiSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,10 @@ class ApiSpec
validGistId,
validGistDescription,
Map(
validGistFilename Some(EditGistFile(validGistFileContent)),
validGistOldFilename Some(
validGistFilename -> Some(EditGistFile(validGistFileContent)),
validGistOldFilename -> Some(
EditGistFile(validGistFileContent, Some(validGistNewFilename))),
validGistDeletedFilename None
validGistDeletedFilename -> None
),
headerUserAgent,
accessToken
Expand Down
6 changes: 3 additions & 3 deletions github4s/shared/src/main/scala/github4s/HttpClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class HttpRequestBuilder[C, M[_]](

def withAuth(accessToken: Option[String] = None) = {
val authHeader = accessToken match {
case Some(token) Map("Authorization" s"token $token")
case Some(token) Map("Authorization" -> s"token $token")
case _ Map.empty[String, String]
}
new HttpRequestBuilder[C, M](url, httpVerb, authHeader, data, params, headers)
Expand Down Expand Up @@ -126,7 +126,7 @@ class HttpClient[C, M[_]](
.withAuth(accessToken)
.withHeaders(headers)
.withParams(params ++ pagination.fold(Map.empty[String, String])(p
Map("page" p.page.toString, "per_page" p.per_page.toString))))
Map("page" -> p.page.toString, "per_page" -> p.per_page.toString))))

def patch[A](
accessToken: Option[String] = None,
Expand Down Expand Up @@ -177,7 +177,7 @@ class HttpClient[C, M[_]](
)(implicit D: Decoder[A]): M[GHResponse[A]] =
httpRbImpl.run[A](
httpRequestBuilder(url).postMethod
.withHeaders(Map("Accept" "application/json") ++ headers)
.withHeaders(Map("Accept" -> "application/json") ++ headers)
.withData(data))

def delete(
Expand Down
6 changes: 3 additions & 3 deletions github4s/shared/src/main/scala/github4s/api/Activities.scala
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ class Activities[C, M[_]](
s"users/$username/starred",
if (timeline) headers + timelineHeader else headers,
Map(
"sort" sort,
"direction" direction
).collect { case (key, Some(value)) key value },
"sort" -> sort,
"direction" -> direction
).collect { case (key, Some(value)) key -> value },
pagination = pagination
)

Expand Down
2 changes: 1 addition & 1 deletion github4s/shared/src/main/scala/github4s/api/Auth.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Auth[C, M[_]](
): M[GHResponse[Authorization]] =
httpClient.postAuth[Authorization](
method = "authorizations",
headers = Map("Authorization" s"Basic ${s"$username:$password".getBytes.toBase64}") ++ headers,
headers = Map("Authorization" -> s"Basic ${s"$username:$password".getBytes.toBase64}") ++ headers,
data = NewAuthRequest(scopes, note, client_id, client_secret).asJson.noSpaces
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ class Organizations[C, M[_]](
s"orgs/$org/members",
headers,
Map(
"filter" filter,
"role" role
).collect { case (key, Some(value)) key value },
"filter" -> filter,
"role" -> role
).collect { case (key, Some(value)) key -> value },
pagination = pagination
)

Expand All @@ -81,7 +81,7 @@ class Organizations[C, M[_]](
accessToken,
s"orgs/$org/outside_collaborators",
headers,
Map("filter" filter).collect { case (key, Some(value)) key value },
Map("filter" -> filter).collect { case (key, Some(value)) key -> value },
pagination
)

Expand Down
20 changes: 10 additions & 10 deletions github4s/shared/src/main/scala/github4s/api/Repos.scala
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ class Repos[C, M[_]](
s"repos/$owner/$repo/commits",
headers,
Map(
"sha" sha,
"path" path,
"author" author,
"since" since,
"until" until
"sha" -> sha,
"path" -> path,
"author" -> author,
"since" -> since,
"until" -> until
).collect {
case (key, Some(value)) key value
case (key, Some(value)) key -> value
},
pagination
)
Expand All @@ -206,9 +206,9 @@ class Repos[C, M[_]](
s"repos/$owner/$repo/branches",
headers,
Map(
"protected" onlyProtected.map(_.toString)
"protected" -> onlyProtected.map(_.toString)
).collect {
case (key, Some(value)) key value
case (key, Some(value)) key -> value
})

/**
Expand All @@ -234,9 +234,9 @@ class Repos[C, M[_]](
s"repos/$owner/$repo/contributors",
headers,
Map(
"anon" anon
"anon" -> anon
).collect {
case (key, Some(value)) key value
case (key, Some(value)) key -> value
})

/**
Expand Down
2 changes: 1 addition & 1 deletion github4s/shared/src/main/scala/github4s/api/Users.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Users[C, M[_]](
pagination: Option[Pagination] = None
): M[GHResponse[List[User]]] =
httpClient
.get[List[User]](accessToken, "users", headers, Map("since" since.toString), pagination)
.get[List[User]](accessToken, "users", headers, Map("since" -> since.toString), pagination)

/**
* Get information for a particular user's list of users they follow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class AuthSpec extends BaseSpec {
val httpClientMock = httpClientMockPostAuth[Authorization](
url = "authorizations",
headers =
Map("Authorization" s"Basic ${s"rafaparadela:invalidPassword".getBytes.toBase64}"),
Map("Authorization" -> s"Basic ${s"rafaparadela:invalidPassword".getBytes.toBase64}"),
json = request,
response = response
)
Expand Down
16 changes: 8 additions & 8 deletions github4s/shared/src/test/scala/github4s/unit/GHGistSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ class GHGistSpec extends BaseSpec {
.expects(
validGistDescription,
validGistPublic,
Map(validGistFilename GistFile(validGistFileContent)),
Map(validGistFilename -> GistFile(validGistFileContent)),
sampleToken)
.returns(response)

val ghGists = new GHGists(sampleToken)(gistOps)
ghGists.newGist(
validGistDescription,
validGistPublic,
Map(validGistFilename GistFile(validGistFileContent)))
Map(validGistFilename -> GistFile(validGistFileContent)))
}

"Gist.getGist" should "call to GistOps with the right parameters without sha" in {
Expand Down Expand Up @@ -95,9 +95,9 @@ class GHGistSpec extends BaseSpec {
validGistId,
validGistDescription,
Map(
validGistFilename Some(EditGistFile(validGistFileContent)),
validGistOldFilename Some(EditGistFile(validGistFileContent, Some(validGistNewFilename))),
validGistDeletedFilename None
validGistFilename -> Some(EditGistFile(validGistFileContent)),
validGistOldFilename -> Some(EditGistFile(validGistFileContent, Some(validGistNewFilename))),
validGistDeletedFilename -> None
),
sampleToken)
.returns(response)
Expand All @@ -107,9 +107,9 @@ class GHGistSpec extends BaseSpec {
validGistId,
validGistDescription,
Map(
validGistFilename Some(EditGistFile(validGistFileContent)),
validGistOldFilename Some(EditGistFile(validGistFileContent, Some(validGistNewFilename))),
validGistDeletedFilename None
validGistFilename -> Some(EditGistFile(validGistFileContent)),
validGistOldFilename -> Some(EditGistFile(validGistFileContent, Some(validGistNewFilename))),
validGistDeletedFilename -> None
))
}

Expand Down
8 changes: 4 additions & 4 deletions github4s/shared/src/test/scala/github4s/unit/GistSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class GistSpec extends BaseSpec {
gists.newGist(
validGistDescription,
validGistPublic,
Map(validGistFilename GistFile(validGistFileContent)),
Map(validGistFilename -> GistFile(validGistFileContent)),
headerUserAgent,
sampleToken
)
Expand Down Expand Up @@ -140,9 +140,9 @@ class GistSpec extends BaseSpec {
validGistId,
validGistDescription,
Map(
validGistFilename Some(EditGistFile(validGistFileContent)),
validGistOldFilename Some(EditGistFile(validGistFileContent, Some(validGistNewFilename))),
validGistDeletedFilename None
validGistFilename -> Some(EditGistFile(validGistFileContent)),
validGistOldFilename -> Some(EditGistFile(validGistFileContent, Some(validGistNewFilename))),
validGistDeletedFilename -> None
),
headerUserAgent,
sampleToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class ReposSpec extends BaseSpec {

val httpClientMock = httpClientMockGet[List[Branch]](
url = s"repos/$validRepoOwner/$validRepoName/branches",
params = Map("protected" "true"),
params = Map("protected" -> "true"),
response = response
)

Expand Down
4 changes: 2 additions & 2 deletions github4s/shared/src/test/scala/github4s/unit/UserSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class UserSpec extends BaseSpec {
val response: GHResponse[List[User]] =
Right(GHResult(List(user), okStatusCode, Map.empty))

val request = Map("since" 1.toString)
val request = Map("since" -> 1.toString)

val httpClientMock = httpClientMockGet[List[User]](
url = "users",
Expand Down Expand Up @@ -90,6 +90,6 @@ class UserSpec extends BaseSpec {
override val httpClient: HttpClient[String, Id] = httpClientMock
}
users.getFollowing(sampleToken, headerUserAgent, validUsername)
}
}

}

0 comments on commit f0a4ada

Please sign in to comment.