|
| 1 | +import org.scalatest.FunSpec |
| 2 | +import org.scalatest.BeforeAndAfterAll |
| 3 | +import codecheck.github.exceptions.NotFoundException |
| 4 | +import codecheck.github.models._ |
| 5 | +import codecheck.github.exceptions.GitHubAPIException |
| 6 | +import codecheck.github.exceptions.NotFoundException |
| 7 | +import scala.concurrent.Await |
| 8 | +import scala.concurrent.ExecutionContext.Implicits.global |
| 9 | +import codecheck.github.models.UserInput |
| 10 | + |
| 11 | +class BranchOpSpec extends FunSpec |
| 12 | + with Constants |
| 13 | + with BeforeAndAfterAll |
| 14 | +{ |
| 15 | + describe("getBranch") { |
| 16 | + it("with valid repo and branch should succeed") { |
| 17 | + val branchOp = Await.result(api.getBranch(user, userRepo, "master"), TIMEOUT) |
| 18 | + assert(branchOp.isDefined) |
| 19 | + assert(branchOp.get.name == "master") |
| 20 | + } |
| 21 | + it("with invalid branch should be None") { |
| 22 | + val branchOp = Await.result(api.getBranch(user, userRepo, "unknown"), TIMEOUT) |
| 23 | + assert(branchOp.isEmpty) |
| 24 | + } |
| 25 | + } |
| 26 | + |
| 27 | + describe("listBranches") { |
| 28 | + it("with valid repo should succeed") { |
| 29 | + val list = Await.result(api.listBranches(user, userRepo), TIMEOUT) |
| 30 | + assert(list.length > 0) |
| 31 | + assert(list.exists(_.name == "master")) |
| 32 | + } |
| 33 | + } |
| 34 | +} |
0 commit comments