File: http01_spec.rb

package info (click to toggle)
ruby-acme-client 2.10.really.2.0.18-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,132 kB
  • sloc: ruby: 2,217; makefile: 7; sh: 3
file content (28 lines) | stat: -rw-r--r-- 797 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

require 'spec_helper'

describe Acme::Client::Resources::Challenges::HTTP01 do
  let(:private_key) { generate_private_key }
  let(:client) do
    Acme::Client.new(private_key: private_key, directory: DIRECTORY_URL)
  end
  let(:attributes) do
    { status: 'pending', url: 'https://example.com/foo/bar', token: 'example_token' }
  end
  let(:http01) do
    Acme::Client::Resources::Challenges::HTTP01.new(client, **attributes)
  end

  context 'file_content' do
    it 'match the key_authorization' do
      expect(http01.file_content).to eq(http01.key_authorization)
    end
  end

  context 'filename' do
    it 'returns the filename path for the http challenge' do
      expect(http01.filename).to eq('.well-known/acme-challenge/example_token')
    end
  end
end