Sha256: 64f3bec68a8058486ad70de9325381ccaf73855ea5800fe08092265caf2abcce

Contents?: true

Size: 1.86 KB

Versions: 18

Compression:

Stored size: 1.86 KB

Contents

When /^I create a hostfactory token for "(.*?)" with CIDR "(.*?)"$/ do |hf, cidr|
  step %Q{I successfully run `conjur hostfactory token create --cidr #{cidr} #{hf}`}
  @hostfactory_token = JSON.parse(last_command_started.stdout)[0]['token']
end

When /^I(?: can)? use the hostfactory token from "(.*?)" to create host "(.*?)"$/ do |ip, host|
  headers['Authorization'] = %Q{Token token="#{@hostfactory_token}"}
  step %Q{I send a POST request forwarded from "#{ip}" to "/api/host_factories/hosts" with:}, table([["id"], [host]]) 
  step %Q{the response status should be "201"}
end

When /^I get the audit event for the resource "(.*?)" with action "(.*?)"$/ do |resource, action|
  # resource needs to be URL-encoded, but cucumber-api URL-encodes the
  # whole string.
  response = RestClient.get(resolve("/api/audit/resources/#{CGI.escape(resource)}"), @headers)
  @response = CucumberApi::Response.create(response)
  @headers = nil
  @body = nil
  step %Q{the response status should be "200"}

  json = JSON.parse(@response)
  @audit_event = json.find {|e| e['action'] == action}
end

Then /^the audit event should show the request from "(.*?)"$/ do |ip|
  expect(@audit_event['request']['ip']).to eq(ip)
end

When /^I create a pubkey for "(.*?)" from "(.*?)" with "(.*?)"$/ do |user, ip, key|
  steps %Q{
    Given I send "text/plain" and accept JSON
    And I set the request body to "#{key}"
    When I send a POST request forwarded from "#{ip}" to "/api/pubkeys/#{user}"
    Then the response status should be "200"
  }
  @pubkey_var = @response.get "resource_identifier"
end

When /^I get the audit event for the pubkey variable with action "(.*?)"$/ do |action|
  # Need reveal, test user doesn't have privilege to see resources
  # created by pubkeys.
  headers['X-Conjur-Privilege'] = 'reveal'
  step %Q{I get the audit event for the resource "#{@pubkey_var}" with action "#{action}"}
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
conjur-cli-6.2.6 features/step_definitions/trusted_proxy_steps.rb
conjur-cli-6.2.5 features/step_definitions/trusted_proxy_steps.rb
conjur-cli-6.2.4 features/step_definitions/trusted_proxy_steps.rb
conjur-cli-6.2.3 features/step_definitions/trusted_proxy_steps.rb
conjur-cli-6.2.2 features/step_definitions/trusted_proxy_steps.rb
conjur-cli-6.2.1 features/step_definitions/trusted_proxy_steps.rb
conjur-cli-6.2.0 features/step_definitions/trusted_proxy_steps.rb
conjur-cli-5.6.6 acceptance-features/step_definitions/trusted_proxy_steps.rb
conjur-cli-6.1.0 features/step_definitions/trusted_proxy_steps.rb
conjur-cli-6.0.1 features/step_definitions/trusted_proxy_steps.rb
conjur-cli-5.6.5 acceptance-features/step_definitions/trusted_proxy_steps.rb
conjur-cli-5.6.4 acceptance-features/step_definitions/trusted_proxy_steps.rb
conjur-cli-5.6.3 acceptance-features/step_definitions/trusted_proxy_steps.rb
conjur-cli-6.0.0 features/step_definitions/trusted_proxy_steps.rb
conjur-cli-6.0.0.rc1 features/step_definitions/trusted_proxy_steps.rb
conjur-cli-5.5.0 acceptance-features/step_definitions/trusted_proxy_steps.rb
conjur-cli-5.4.0 acceptance-features/step_definitions/trusted_proxy_steps.rb
conjur-cli-5.3.0 acceptance-features/step_definitions/trusted_proxy_steps.rb