@@ -173,7 +173,7 @@ func TestDownload(t *testing.T) {
173173}
174174
175175func TestOpenVulnerabilityIssue (t * testing.T ) {
176- title := "666"
176+ title := repository . VulnerabilityIssueTitle
177177 mockClient := mockService {}
178178 mockClient .On ("ListRepositoryIssues" , mock .Anything , mock .Anything , mock .Anything ).Return ([]* github.Issue {}, & github.Response {}, nil )
179179 mockClient .On ("CreateIssue" , mock .Anything , mock .Anything , mock .Anything ).Return (& github.Issue {Title : & title }, & github.Response {}, nil )
@@ -183,18 +183,22 @@ func TestOpenVulnerabilityIssue(t *testing.T) {
183183 i , err := svc .OpenVulnerabilityIssue (repository.Project {GroupOrOwner : "group" , Name : "repo" }, "report" )
184184 assert .Nil (t , err )
185185 assert .NotNil (t , i )
186- assert .Equal (t , "666" , i .Title )
186+ assert .Equal (t , repository .VulnerabilityIssueTitle , i .Title )
187+ mockClient .AssertExpectations (t )
187188}
188189
189190func TestCloseVulnerabilityIssue (t * testing.T ) {
190- title := "288"
191+ title := repository .VulnerabilityIssueTitle
192+ state := "open"
191193 mockClient := mockService {}
192- mockClient .On ("ListRepositoryIssues" , mock .Anything , mock .Anything , mock .Anything ).Return ([]* github.Issue {{Title : & title }}, & github.Response {}, nil )
194+ mockClient .On ("ListRepositoryIssues" , mock .Anything , mock .Anything , mock .Anything ).Return ([]* github.Issue {{Title : & title , State : & state }}, & github.Response {}, nil )
195+ mockClient .On ("UpdateIssue" , mock .Anything , mock .Anything , mock .Anything , mock .Anything ).Return (& github.Issue {}, & github.Response {}, nil )
193196
194197 svc := githubService {client : & mockClient }
195198
196199 err := svc .CloseVulnerabilityIssue (repository.Project {GroupOrOwner : "group" , Name : "repo" })
197200 assert .Nil (t , err )
201+ mockClient .AssertExpectations (t )
198202}
199203
200204func TestCloseVulnerabilityIssueNoIssue (t * testing.T ) {
@@ -205,6 +209,7 @@ func TestCloseVulnerabilityIssueNoIssue(t *testing.T) {
205209
206210 err := svc .CloseVulnerabilityIssue (repository.Project {GroupOrOwner : "group" , Name : "repo" })
207211 assert .Nil (t , err )
212+ mockClient .AssertExpectations (t )
208213}
209214
210215type mockService struct {
0 commit comments