-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds the git ops for fetching and create commits * Adds some tests for the git ops * Disables minimum coverage for scalaz and js modules
- Loading branch information
Fede Fernández
authored
Mar 28, 2017
1 parent
111be95
commit d00e132
Showing
22 changed files
with
1,831 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
github4s/js/src/test/scala/github4s/utils/integration/GHGitDataSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright (c) 2016 47 Degrees, LLC. <http://www.47deg.com> | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* this software and associated documentation files (the "Software"), to deal in | ||
* the Software without restriction, including without limitation the rights to | ||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
* the Software, and to permit persons to whom the Software is furnished to do so, | ||
* subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
package github4s.utils.integration | ||
|
||
import cats.data.NonEmptyList | ||
import github4s.Github | ||
import github4s.Github._ | ||
import github4s.free.domain.{Ref, RefCommit} | ||
import github4s.js.Implicits._ | ||
import github4s.utils.TestUtils | ||
import org.scalatest._ | ||
|
||
class GHGitDataSpec extends AsyncFlatSpec with Matchers with TestUtils { | ||
|
||
override implicit val executionContext = | ||
scala.concurrent.ExecutionContext.Implicits.global | ||
|
||
"GitData >> GetReference" should "return a list of references" in { | ||
val response = Github(accessToken).gitData | ||
.getReference(validRepoOwner, validRepoName, "heads") | ||
.execFuture(headerUserAgent) | ||
|
||
testFutureIsRight[NonEmptyList[Ref]](response, { r => | ||
r.result.tail.nonEmpty shouldBe true | ||
r.statusCode shouldBe okStatusCode | ||
}) | ||
} | ||
|
||
it should "return at least one reference" in { | ||
val response = Github(accessToken).gitData | ||
.getReference(validRepoOwner, validRepoName, validRefSingle) | ||
.execFuture(headerUserAgent) | ||
|
||
testFutureIsRight[NonEmptyList[Ref]](response, { r => | ||
r.result.head.ref.contains(validRefSingle) shouldBe true | ||
r.statusCode shouldBe okStatusCode | ||
}) | ||
} | ||
|
||
"GitData >> GetCommit" should "return one commit" in { | ||
val response = Github(accessToken).gitData | ||
.getCommit(validRepoOwner, validRepoName, validCommitSha) | ||
.execFuture(headerUserAgent) | ||
|
||
testFutureIsRight[RefCommit](response, { r => | ||
r.result.message shouldBe validCommitMsg | ||
r.statusCode shouldBe okStatusCode | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
github4s/jvm/src/test/scala/github4s/integration/GHGitDataSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright (c) 2016 47 Degrees, LLC. <http://www.47deg.com> | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* this software and associated documentation files (the "Software"), to deal in | ||
* the Software without restriction, including without limitation the rights to | ||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
* the Software, and to permit persons to whom the Software is furnished to do so, | ||
* subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
package github4s.integration | ||
|
||
import cats.Id | ||
import cats.implicits._ | ||
import github4s.Github | ||
import github4s.Github._ | ||
import github4s.jvm.Implicits._ | ||
import github4s.utils.TestUtils | ||
import org.scalatest._ | ||
|
||
import scalaj.http.HttpResponse | ||
|
||
class GHGitDataSpec extends FlatSpec with Matchers with TestUtils { | ||
|
||
"GitData >> GetReference" should "return a list of references" in { | ||
val response = Github(accessToken).gitData | ||
.getReference(validRepoOwner, validRepoName, "heads") | ||
.exec[Id, HttpResponse[String]](headerUserAgent) | ||
|
||
response should be('right) | ||
response.toOption map { r ⇒ | ||
r.result.tail.nonEmpty shouldBe true | ||
r.statusCode shouldBe okStatusCode | ||
} | ||
} | ||
|
||
it should "return at least one reference" in { | ||
val response = Github(accessToken).gitData | ||
.getReference(validRepoOwner, validRepoName, validRefSingle) | ||
.exec[Id, HttpResponse[String]](headerUserAgent) | ||
|
||
response should be('right) | ||
response.toOption map { r ⇒ | ||
r.result.head.ref.contains(validRefSingle) shouldBe true | ||
r.statusCode shouldBe okStatusCode | ||
} | ||
} | ||
|
||
"GitData >> GetCommit" should "return one commit" in { | ||
val response = Github(accessToken).gitData | ||
.getCommit(validRepoOwner, validRepoName, validCommitSha) | ||
.exec[Id, HttpResponse[String]](headerUserAgent) | ||
|
||
response should be('right) | ||
response.toOption map { r ⇒ | ||
r.result.message shouldBe validCommitMsg | ||
r.statusCode shouldBe okStatusCode | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.