summaryrefslogtreecommitdiff
path: root/spec/support/helpers
diff options
context:
space:
mode:
authorVladimir Shushlin <v.shushlin@gmail.com>2019-04-24 11:05:33 +0200
committerVladimir Shushlin <v.shushlin@gmail.com>2019-05-15 15:38:15 +0300
commit14a97af604a6ee260bd29024c7ffba41b5750ddc (patch)
tree169d9b371b3d0b7d73f090609c88c35358290781 /spec/support/helpers
parent3ed275536488e10c10d3c341fbd0fcf7abd891bf (diff)
downloadgitlab-ce-acme-module.tar.gz
Add Let's Encrypt clientacme-module
Part of adding Let's Encrypt certificates for pages domains Add acme-client gem Client is being initialized by private key stored in secrets.yml Let's Encrypt account is being created lazily. If it's already created, Acme::Client just gets account_kid by calling new_account method Make Let's Encrypt client an instance Wrap order and challenge classes
Diffstat (limited to 'spec/support/helpers')
-rw-r--r--spec/support/helpers/lets_encrypt_helpers.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/support/helpers/lets_encrypt_helpers.rb b/spec/support/helpers/lets_encrypt_helpers.rb
new file mode 100644
index 00000000000..7f0886b451c
--- /dev/null
+++ b/spec/support/helpers/lets_encrypt_helpers.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+module LetsEncryptHelpers
+ def stub_lets_encrypt_client
+ client = instance_double('Acme::Client')
+
+ allow(client).to receive(:new_account)
+ allow(client).to receive(:terms_of_service).and_return(
+ "https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf"
+ )
+
+ allow(Acme::Client).to receive(:new).with(
+ private_key: kind_of(OpenSSL::PKey::RSA),
+ directory: ::Gitlab::LetsEncrypt::Client::STAGING_DIRECTORY_URL
+ ).and_return(client)
+
+ client
+ end
+end