Skip to content

Commit

Permalink
Add ability to search by sha256
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Brossia <abrossia@gmail.com>
  • Loading branch information
aae42 committed Oct 25, 2020
1 parent 4ec0063 commit 6afd0b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion lib/artifactory/resources/artifact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ def property_search(options = {})
# the MD5 checksum of the artifact to search for
# @option options [String] :sha1
# the SHA1 checksum of the artifact to search for
# @option options [String] :sha256
# the SHA256 checksum of the artifact to search for
# @option options [String, Array<String>] :repos
# the list of repos to search
#
Expand All @@ -177,7 +179,7 @@ def property_search(options = {})
#
def checksum_search(options = {})
client = extract_client!(options)
params = Util.slice(options, :md5, :sha1, :repos)
params = Util.slice(options, :md5, :sha1, :sha256, :repos)
format_repos!(params)

client.get("/api/search/checksum", params)["results"].map do |artifact|
Expand Down
12 changes: 7 additions & 5 deletions spec/unit/resources/artifact_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,14 @@ module Artifactory

it "slices the correct parameters" do
expect(client).to receive(:get).with("/api/search/checksum",
md5: "MD5123",
sha1: "SHA456").once
md5: "MD5123",
sha1: "SHA456",
sha256: "SHA789").once
described_class.checksum_search(
md5: "MD5123",
sha1: "SHA456",
fizz: "foo"
md5: "MD5123",
sha1: "SHA456",
sha256: "SHA789",
fizz: "foo"
)
end

Expand Down

0 comments on commit 6afd0b1

Please sign in to comment.