2020-10-10 14:16:11 +02:00
|
|
|
# typed: false
|
2020-03-30 21:07:45 +11:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "bintray"
|
|
|
|
|
|
|
|
describe Bintray, :needs_network do
|
2020-07-23 01:20:31 +02:00
|
|
|
subject(:bintray) { described_class.new(org: "homebrew") }
|
|
|
|
|
|
|
|
before do
|
|
|
|
ENV["HOMEBREW_BINTRAY_USER"] = "BrewTestBot"
|
|
|
|
ENV["HOMEBREW_BINTRAY_KEY"] = "deadbeef"
|
|
|
|
end
|
|
|
|
|
2020-10-12 20:56:14 +11:00
|
|
|
describe "::remote_checksum" do
|
2020-03-30 21:07:45 +11:00
|
|
|
it "detects a published file" do
|
2020-10-12 20:56:14 +11:00
|
|
|
hash = bintray.remote_checksum(repo: "bottles", remote_file: "hello-2.10.catalina.bottle.tar.gz")
|
|
|
|
expect(hash).to eq("449de5ea35d0e9431f367f1bb34392e450f6853cdccdc6bd04e6ad6471904ddb")
|
2020-03-30 21:07:45 +11:00
|
|
|
end
|
|
|
|
|
2020-11-15 13:42:01 +09:00
|
|
|
it "fails on a non-existent file" do
|
2020-10-12 20:56:14 +11:00
|
|
|
hash = bintray.remote_checksum(repo: "bottles", remote_file: "my-fake-bottle-1.0.snow_hyena.tar.gz")
|
|
|
|
expect(hash).to be nil
|
2020-03-30 21:07:45 +11:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "::package_exists?" do
|
|
|
|
it "detects a package" do
|
|
|
|
results = bintray.package_exists?(repo: "bottles", package: "hello")
|
2020-04-21 14:21:34 +01:00
|
|
|
expect(results).to be true
|
2020-03-30 21:07:45 +11:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|