@@ -14,14 +14,42 @@ import codecheck.github.models.IssueInput
14
14
import codecheck .github .models .MilestoneSearchOption
15
15
16
16
import codecheck .github .models .MilestoneInput
17
+ import codecheck .github .models .MilestoneListOption
18
+ import codecheck .github .models .MilestoneState
19
+ import codecheck .github .models .Milestone
17
20
18
- class IssueOpSpec extends FunSpec with Constants {
21
+ class IssueOpSpec extends FunSpec with Constants with BeforeAndAfter {
19
22
20
23
val number = 1
21
24
var nUser : Long = 0
22
25
var nOrg : Long = 0
23
26
var nTime : DateTime = DateTime .now()
24
27
28
+ private def removeAll = {
29
+ val userMilestones = Await .result(api.listMilestones(user, userRepo, MilestoneListOption (state= MilestoneState .all)), TIMEOUT )
30
+ userMilestones.foreach { m =>
31
+ Await .result(api.removeMilestone(user, userRepo, m.number), TIMEOUT )
32
+ }
33
+
34
+ val orgMilestones = Await .result(api.listMilestones(organization, repo, MilestoneListOption (state= MilestoneState .all)), TIMEOUT )
35
+ orgMilestones.foreach { m =>
36
+ Await .result(api.removeMilestone(organization, repo, m.number), TIMEOUT )
37
+ }
38
+ }
39
+
40
+ before {
41
+ removeAll
42
+
43
+ val nInput = new MilestoneInput (Some (" test milestone" ))
44
+ val nInput2 = new MilestoneInput (Some (" test milestone 2" ))
45
+
46
+ Await .result(api.createMilestone(user, userRepo, nInput), TIMEOUT )
47
+ Await .result(api.createMilestone(organization, repo, nInput), TIMEOUT )
48
+
49
+ Await .result(api.createMilestone(user, userRepo, nInput2), TIMEOUT )
50
+ Await .result(api.createMilestone(organization, repo, nInput2), TIMEOUT )
51
+ }
52
+
25
53
describe(" createIssue(owner, repo, input)" ) {
26
54
val input = IssueInput (Some (" test issue" ), Some (" testing" ), Some (user), Some (1 ), Seq (" question" ))
27
55
0 commit comments