Sha256: d2ecce78254d555a222c6fce45d5821c8abc44a35d205ddd9a1311d11d546e41
Contents?: true
Size: 1.55 KB
Versions: 4
Compression:
Stored size: 1.55 KB
Contents
require "spec_helper" RSpec.describe Digicert::CLI::CSR do describe "#fetch" do it "fetches the csr for an existing order" do order_id = 123456 stub_digicert_order_fetch_api(order_id) csr = Digicert::CLI::CSR.new(order_id: order_id).fetch expect(csr).not_to be_nil expect(csr).to eq("------ [CSR HERE] ------") end end describe "#generate" do context "with existing order details" do it "generates a new csr for an existing order" do order_id = 123456 key_file = "./spec/fixtures/rsa4096.key" stub_digicert_order_fetch_api(order_id) csr = Digicert::CLI::CSR.new(order_id: order_id, key: key_file).generate expect(csr.start_with?("-----BEGIN CERTIFICATE REQUEST")).to be_truthy expect(csr.end_with?("--END CERTIFICATE REQUEST-----\n")).to be_truthy end end context "with custom details" do it "generates a new csr using the provided details" do organization_id = 123456 common_name = "ribosetest.com" key_file = "./spec/fixtures/rsa4096.key" san = ["site1.ribosetest.com", "site2.ribosetest.com"] stub_digicert_organization_fetch_api(organization_id) csr = Digicert::CLI::CSR.new( san: san, key: key_file, common_name: common_name, organization_id: organization_id, ).generate expect(csr.start_with?("-----BEGIN CERTIFICATE REQUEST")).to be_truthy expect(csr.end_with?("--END CERTIFICATE REQUEST-----\n")).to be_truthy end end end end
Version data entries
4 entries across 4 versions & 1 rubygems