Sha256: e9abf9e8766b0fd7ce8b35ef1a292e6403907af548e6a87d9408adbdbc9df9d4

Contents?: true

Size: 1020 Bytes

Versions: 4

Compression:

Stored size: 1020 Bytes

Contents

# encoding: utf-8
require_relative "../spec_helper"
require "google/api_client"
require "tempfile"

describe LogStash::Outputs::GoogleCloudStorage do

  let(:client) { double("google-client") }
  let(:service_account) { double("service-account") }
  let(:key)    { "key" }

  subject { described_class.new(config) }
  let(:config) { {"bucket" => "", "key_path" => "", "service_account" => "", "uploader_interval_secs" => 0.1, "upload_synchronous" => true} }

  before(:each) do
    allow(Google::APIClient).to receive(:new).and_return(client)
    allow(client).to receive(:discovered_api).with("storage", "v1")
    allow(Google::APIClient::PKCS12).to receive(:load_key).with("", "notasecret").and_return(key)
    allow(Google::APIClient::JWTAsserter).to receive(:new).and_return(service_account)
    allow(client).to receive(:authorization=)
    allow(service_account).to receive(:authorize)
  end

  it "should register without errors" do
    expect { subject.register }.to_not raise_error

    subject.close
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
logstash-output-googlecloudstorage-1.0.0-java spec/outputs/google_cloud_storage_spec.rb
logstash-output-googlecloudstorage-0.3.0-java spec/outputs/google_cloud_storage_spec.rb
logstash-output-googlecloudstorage-0.1.0-java spec/outputs/google_cloud_storage_spec.rb
logstash-output-google_cloud_storage-3.3.0 spec/outputs/google_cloud_storage_spec.rb