Skip to content

Commit dd2481f

Browse files
committed
Add test
1 parent f0e7381 commit dd2481f

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.codacy.client.bitbucket.v2
2+
import org.scalatest.{Matchers, _}
3+
import play.api.libs.json.Json
4+
5+
class RepositorySpecs extends FlatSpec with Matchers {
6+
7+
"RepositorySpecs" should "successfully parse DeployKey" in {
8+
val input = """
9+
|{
10+
| "id": 123,
11+
| "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5",
12+
| "label": "mydeploykey",
13+
| "type": "deploy_key",
14+
| "created_on": "2018-08-15T23:50:59.993890+00:00",
15+
| "repository": {
16+
| "full_name": "mleu/test",
17+
| "name": "test",
18+
| "type": "repository",
19+
| "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}"
20+
| },
21+
| "links":{
22+
| "self":{
23+
| "href": "https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-keys/123"
24+
| }
25+
| },
26+
| "last_used": null,
27+
| "comment": "mleu@C02W454JHTD8"
28+
|}
29+
""".stripMargin
30+
val json = Json.parse(input)
31+
val value = json.validate[DeployKey]
32+
33+
value.fold(e => fail(s"$e"), r => r.id shouldBe 123)
34+
}
35+
}

0 commit comments

Comments
 (0)