summaryrefslogtreecommitdiff
path: root/qa/qa/factory/resource/ssh_key.rb
blob: a512d071dd4e10bbc5c6177356b13b8f5219b9c9 (plain)
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
29
30
31
32
# frozen_string_literal: true

module QA
  module Factory
    module Resource
      class SSHKey < Factory::Base
        extend Forwardable

        attr_accessor :title
        attr_reader :private_key, :public_key, :fingerprint
        def_delegators :key, :private_key, :public_key, :fingerprint

        product :private_key
        product :title
        product :fingerprint

        def key
          @key ||= Runtime::Key::RSA.new
        end

        def fabricate!
          Page::Main::Menu.act { go_to_profile_settings }
          Page::Profile::Menu.act { click_ssh_keys }

          Page::Profile::SSHKeys.perform do |page|
            page.add_key(public_key, title)
          end
        end
      end
    end
  end
end