@@ -40,10 +40,8 @@ class PRServiceTests extends PullRequestService {
40
40
}
41
41
42
42
@ Test def canGetAllCommitsFromPR = {
43
- val httpClient = PooledHttp1Client ()
44
43
val issueNbr = 1941 // has 2 commits: https://github.com/lampepfl/dotty/pull/1941/commits
45
-
46
- val List (c1, c2) = getCommits(issueNbr, httpClient).run
44
+ val List (c1, c2) = withClient(getCommits(issueNbr, _))
47
45
48
46
assertEquals(
49
47
" Represent untyped operators as Ident instead of Name" ,
@@ -57,10 +55,8 @@ class PRServiceTests extends PullRequestService {
57
55
}
58
56
59
57
@ Test def canGetMoreThan100Commits = {
60
- val httpClient = PooledHttp1Client ()
61
58
val issueNbr = 1840 // has >100 commits: https://github.com/lampepfl/dotty/pull/1840/commits
62
-
63
- val numberOfCommits = getCommits(issueNbr, httpClient).run.length
59
+ val numberOfCommits = withClient(getCommits(issueNbr, _)).length
64
60
65
61
assert(
66
62
numberOfCommits > 100 ,
@@ -69,27 +65,24 @@ class PRServiceTests extends PullRequestService {
69
65
}
70
66
71
67
@ Test def canGetComments = {
72
- val comments : List [Comment ] = withClient(c => getComments(2136 , c ))
68
+ val comments : List [Comment ] = withClient(getComments(2136 , _ ))
73
69
74
70
assert(comments.find(_.user.login == Some (" odersky" )).isDefined,
75
71
" Could not find Martin's comment on PR 2136" )
76
72
}
77
73
78
74
@ Test def canCheckCLA = {
79
- val httpClient = PooledHttp1Client ()
80
75
val validUserCommit = Commit (" sha-here" , Author (Some (" felixmulder" )), Author (Some (" felixmulder" )), CommitInfo (" " ))
81
- val statuses : List [CommitStatus ] = checkCLA(validUserCommit :: Nil , httpClient).run
76
+ val statuses : List [CommitStatus ] = withClient( checkCLA(validUserCommit :: Nil , _))
82
77
83
78
assert(statuses.length == 1 , s " wrong number of valid statuses: got ${statuses.length}, expected 1 " )
84
- httpClient.shutdownNow()
85
79
}
86
80
87
81
@ Test def canSetStatus = {
88
- val httpClient = PooledHttp1Client ()
89
82
val sha = " fa64b4b613fe5e78a5b4185b4aeda89e2f1446ff"
90
83
val status = Invalid (" smarter" , Commit (sha, Author (Some (" smarter" )), Author (Some (" smarter" )), CommitInfo (" " )))
91
84
92
- val statuses : List [StatusResponse ] = sendStatuses(status :: Nil , httpClient).run
85
+ val statuses : List [StatusResponse ] = withClient( sendStatuses(status :: Nil , _))
93
86
94
87
assert(
95
88
statuses.length == 1 ,
@@ -100,8 +93,6 @@ class PRServiceTests extends PullRequestService {
100
93
statuses.head.state == " failure" ,
101
94
s " status set had wrong state, expected 'failure', got: ${statuses.head.state}"
102
95
)
103
-
104
- httpClient.shutdownNow()
105
96
}
106
97
107
98
@ Test def canGetStatus = {
0 commit comments