@@ -642,6 +642,18 @@ func TestAnalysis_RunAnalysis_GetFindingsError(t *testing.T) {
642
642
req := i .(* http.Request )
643
643
return req .URL .String () == "http://localhost/rest/orgs/b6fc8954-5918-45ce-bc89-54591815ce1b/scans/a6fb2742-b67f-4dc3-bb27-42b67f1dc344?version=2024-02-16~experimental" &&
644
644
req .Method == http .MethodGet
645
+ })).Times (1 ).Return (& http.Response {
646
+ StatusCode : http .StatusOK ,
647
+ Header : http.Header {
648
+ "Content-Type" : []string {"application/vnd.api+json" },
649
+ },
650
+ Body : io .NopCloser (bytes .NewReader ([]byte (`{"data":{"attributes": {"status": "done", "components":[{"findings_url": "http://findings_url"}]}, "id": "a6fb2742-b67f-4dc3-bb27-42b67f1dc344"}}` ))),
651
+ }, nil )
652
+
653
+ mockHTTPClient .EXPECT ().Do (mock .MatchedBy (func (i interface {}) bool {
654
+ req := i .(* http.Request )
655
+ return req .URL .String () == "http://findings_url" &&
656
+ req .Method == http .MethodGet
645
657
})).Times (1 ).Return (nil , errors .New ("error" ))
646
658
647
659
analysisOrchestrator := analysis .NewAnalysisOrchestrator (
@@ -654,9 +666,8 @@ func TestAnalysis_RunAnalysis_GetFindingsError(t *testing.T) {
654
666
)
655
667
656
668
_ , err := analysisOrchestrator .RunAnalysis (context .Background (), "b6fc8954-5918-45ce-bc89-54591815ce1b" , "rootPath" , "c172d1db-b465-4764-99e1-ecedad03b06a" )
657
- assert .ErrorContains (t , err , "error" )
669
+ require .ErrorContains (t , err , "error" )
658
670
}
659
-
660
671
func TestAnalysis_RunAnalysis_GetFindingsNotSuccessful (t * testing.T ) {
661
672
mockConfig , mockHTTPClient , mockInstrumentor , mockErrorReporter , mockTracker , mockTrackerFactory , logger := setup (t , nil )
662
673
0 commit comments