@@ -14,8 +14,8 @@ def teardown
1414 end
1515
1616 def test_bulk_lookup_returns_packages_by_purl
17- stub_request ( :post , "https://packages.ecosyste.ms/api/v1/packages/lookup " )
18- . with ( body : { purl : [ "pkg:gem/rails" , "pkg:npm/lodash" ] } . to_json )
17+ stub_request ( :post , "https://packages.ecosyste.ms/api/v1/packages/bulk_lookup " )
18+ . with ( body : { purls : [ "pkg:gem/rails" , "pkg:npm/lodash" ] } . to_json )
1919 . to_return (
2020 status : 200 ,
2121 body : [
@@ -54,17 +54,17 @@ def test_bulk_lookup_batches_large_requests
5454 purls = ( 1 ..150 ) . map { |i | "pkg:npm/package-#{ i } " }
5555
5656 # First batch of 100
57- stub_request ( :post , "https://packages.ecosyste.ms/api/v1/packages/lookup " )
58- . with { |req | JSON . parse ( req . body ) [ "purl " ] . size == 100 }
57+ stub_request ( :post , "https://packages.ecosyste.ms/api/v1/packages/bulk_lookup " )
58+ . with { |req | JSON . parse ( req . body ) [ "purls " ] . size == 100 }
5959 . to_return (
6060 status : 200 ,
6161 body : ( 1 ..100 ) . map { |i | { "purl" => "pkg:npm/package-#{ i } " , "name" => "package-#{ i } " } } . to_json ,
6262 headers : { "Content-Type" => "application/json" }
6363 )
6464
6565 # Second batch of 50
66- stub_request ( :post , "https://packages.ecosyste.ms/api/v1/packages/lookup " )
67- . with { |req | JSON . parse ( req . body ) [ "purl " ] . size == 50 }
66+ stub_request ( :post , "https://packages.ecosyste.ms/api/v1/packages/bulk_lookup " )
67+ . with { |req | JSON . parse ( req . body ) [ "purls " ] . size == 50 }
6868 . to_return (
6969 status : 200 ,
7070 body : ( 101 ..150 ) . map { |i | { "purl" => "pkg:npm/package-#{ i } " , "name" => "package-#{ i } " } } . to_json ,
@@ -77,8 +77,8 @@ def test_bulk_lookup_batches_large_requests
7777 end
7878
7979 def test_lookup_single_package
80- stub_request ( :post , "https://packages.ecosyste.ms/api/v1/packages/lookup " )
81- . with ( body : { purl : [ "pkg:gem/rails" ] } . to_json )
80+ stub_request ( :post , "https://packages.ecosyste.ms/api/v1/packages/bulk_lookup " )
81+ . with ( body : { purls : [ "pkg:gem/rails" ] } . to_json )
8282 . to_return (
8383 status : 200 ,
8484 body : [ { "purl" => "pkg:gem/rails" , "latest_release_number" => "7.1.0" } ] . to_json ,
@@ -91,7 +91,7 @@ def test_lookup_single_package
9191 end
9292
9393 def test_lookup_returns_nil_for_not_found
94- stub_request ( :post , "https://packages.ecosyste.ms/api/v1/packages/lookup " )
94+ stub_request ( :post , "https://packages.ecosyste.ms/api/v1/packages/bulk_lookup " )
9595 . to_return ( status : 404 )
9696
9797 result = @client . lookup ( "pkg:gem/nonexistent" )
@@ -100,7 +100,7 @@ def test_lookup_returns_nil_for_not_found
100100 end
101101
102102 def test_api_error_on_failure
103- stub_request ( :post , "https://packages.ecosyste.ms/api/v1/packages/lookup " )
103+ stub_request ( :post , "https://packages.ecosyste.ms/api/v1/packages/bulk_lookup " )
104104 . to_return ( status : 500 , body : "Internal Server Error" )
105105
106106 assert_raises ( Git ::Pkgs ::EcosystemsClient ::ApiError ) do
@@ -109,7 +109,7 @@ def test_api_error_on_failure
109109 end
110110
111111 def test_api_error_on_timeout
112- stub_request ( :post , "https://packages.ecosyste.ms/api/v1/packages/lookup " )
112+ stub_request ( :post , "https://packages.ecosyste.ms/api/v1/packages/bulk_lookup " )
113113 . to_timeout
114114
115115 assert_raises ( Git ::Pkgs ::EcosystemsClient ::ApiError ) do
0 commit comments