11import org .scalatest .path .FunSpec
22import codecheck .github .exceptions .NotFoundException
33import codecheck .github .models .Repository
4+ import codecheck .github .models .RepositoryInput
45import codecheck .github .exceptions .GitHubAPIException
56import codecheck .github .exceptions .NotFoundException
67import scala .concurrent .Await
78import scala .concurrent .ExecutionContext .Implicits .global
89
9- class RepositoryOpSpec extends FunSpec with Constants
10+ class RepositoryOpSpec extends FunSpec with Constants
1011{
1112
1213 describe(" listOwnRepositories" ) {
@@ -45,7 +46,7 @@ class RepositoryOpSpec extends FunSpec with Constants
4546 assert(list.size > 0 )
4647 }
4748
48-
49+
4950 }
5051 describe(" getRepository" ) {
5152 it(" should succeed" ) {
@@ -61,4 +62,28 @@ class RepositoryOpSpec extends FunSpec with Constants
6162 assert(Await .result(api.getRepository(organization, repoInvalid), TIMEOUT ).isEmpty)
6263 }
6364 }
65+
66+ /*
67+ describe("createUserRepository") {
68+ val createRepoName = "create-repo-name"
69+ it("should succeed") {
70+ val input = RepositoryInput(name = createRepoName)
71+ val repo = Await.result(api.createUserRepository(input), TIMEOUT)
72+ assert(repo.owner.login == user)
73+ assert(repo.name == "create-repo-test")
74+ }
75+ it("should fail with existing repository name") {
76+ val input = RepositoryInput(name = createRepoName)
77+ try {
78+ val repo = Await.result(api.createUserRepository(input), TIMEOUT)
79+ fail
80+ } catch {
81+ case e: GitHubAPIException =>
82+ assert(e.error.errors.head.field == "name")
83+ case e: Throwable =>
84+ fail
85+ }
86+ }
87+ }
88+ */
6489}
0 commit comments