1
1
2
2
import org .scalatest .FunSpec
3
+ import org .scalatest .BeforeAndAfter
3
4
import scala .concurrent .Await
4
5
import org .joda .time .DateTime
5
6
import org .joda .time .DateTimeZone
@@ -12,6 +13,8 @@ import codecheck.github.models.Issue
12
13
import codecheck .github .models .IssueInput
13
14
import codecheck .github .models .MilestoneSearchOption
14
15
16
+ import codecheck .github .models .MilestoneInput
17
+
15
18
class IssueOpSpec extends FunSpec with Constants {
16
19
17
20
val number = 1
@@ -108,6 +111,7 @@ class IssueOpSpec extends FunSpec with Constants {
108
111
it(" shold return at least one issue." ) {
109
112
val result = Await .result(api.listAllIssues(), TIMEOUT )
110
113
assert(result.length > 0 )
114
+ assert(result.head.repository.name == " test-repo" )
111
115
}
112
116
113
117
it(" shold return only two issues when using options." ) {
@@ -122,6 +126,7 @@ class IssueOpSpec extends FunSpec with Constants {
122
126
it(" shold return at least one issue." ) {
123
127
val result = Await .result(api.listUserIssues(), TIMEOUT )
124
128
assert(result.length > 0 )
129
+ assert(result.head.repository.name == " test-repo" )
125
130
}
126
131
127
132
it(" shold return only one issues when using options." ) {
@@ -148,7 +153,7 @@ class IssueOpSpec extends FunSpec with Constants {
148
153
149
154
describe(" listRepositoryIssues(owner, repo, option)" ) {
150
155
it(" should return at least one issue from user's own repo." ) {
151
- val result = Await .result(api.listRepositoryIssues(organization, repo ), TIMEOUT )
156
+ val result = Await .result(api.listRepositoryIssues(user, userRepo ), TIMEOUT )
152
157
assert(result.length > 0 )
153
158
}
154
159
@@ -159,17 +164,17 @@ class IssueOpSpec extends FunSpec with Constants {
159
164
160
165
it(" should return only one issue from user's own repo when using options." ) {
161
166
val option = new IssueListOption4Repository (Some (MilestoneSearchOption (1 )), IssueState .open, Some (user), Some (user), labels= Seq (" question" ), since= Some (nTime))
162
- val result = Await .result(api.listRepositoryIssues(user, userRepo), TIMEOUT )
163
- // showResponse(result )
167
+ val result = Await .result(api.listRepositoryIssues(user, userRepo, option ), TIMEOUT )
168
+ showResponse(option.q )
164
169
assert(result.length == 1 )
170
+ assert(result.head.title == " test issue" )
165
171
}
166
172
167
173
it(" should return only one issue from organization's repo when using options." ) {
168
- val option = IssueListOption4Repository (Some (MilestoneSearchOption .all ), IssueState .open, Some (user), Some (user), labels= Seq (" question" ), since= Some (nTime))
174
+ val option = new IssueListOption4Repository (Some (MilestoneSearchOption ( 1 ) ), IssueState .open, Some (user), Some (user), labels= Seq (" question" ), since= Some (nTime))
169
175
val result = Await .result(api.listRepositoryIssues(organization, repo, option), TIMEOUT )
170
- showResponse(option.q)
171
- showResponse(result)
172
- // assert(result.length == 1)
176
+ assert(result.length == 1 )
177
+ assert(result.head.title == " test issue" )
173
178
}
174
179
}
175
180
0 commit comments