Sha256: 970cdb6572f542e3e4a9d534b4f589a0835d12b9e62bde8b486ef6e4298058ff

Contents?: true

Size: 1.82 KB

Versions: 11

Compression:

Stored size: 1.82 KB

Contents

Given(/^I login as a new user$/) do
  @username_index ||= 0
  username = %w(alice bob charles dave edward)[@username_index]
  raise "I'm out of usernames!" unless username
  @username_index += 1
  @username = "#{username}@$ns"
  step %Q(I login as new user "#{@username}")
end

Given(/^I create a new user named "(.*?)"$/) do |username|
  username_ns = username.gsub('$ns',@namespace)
 
  step "I successfully run `conjur user create --as-role user:admin@#{@namespace} #{username_ns}`"
  
  user_info = JSON.parse(last_command_started.stdout)
  save_password username_ns, user_info['api_key']
end

Given(/^I create a new host with id "(.*?)"$/) do |hostid|
  step "I successfully run `conjur host create #{@namespace}/monitoring/server`"
  host = JSON.parse(last_json)
  @host_id = host['id']
  @host_api_key = host['api_key']
end

Given(/^I login as the new host/) do
  step %Q(I set the environment variable "CONJUR_AUTHN_LOGIN" to "host/#{@host_id}")
  step %Q(I set the environment variable "CONJUR_AUTHN_API_KEY" to "#{@host_api_key}")
end

Given(/^I login as new user "(.*?)"$/) do |username|
  username_ns = username.gsub('$ns',@namespace)
  step %Q(I create a new user named "#{username_ns}")
  step %Q(I login as "#{username_ns}")
end

Given(/^I login as "(.*?)"$/) do |username|
  username_ns = username.gsub('$ns',@namespace)
  password = find_password(username_ns)
  
  step %Q(I set the environment variable "CONJUR_AUTHN_LOGIN" to "#{username_ns}")
  step %Q(I set the environment variable "CONJUR_AUTHN_API_KEY" to "#{password}")
end

Then(/^I(?: can)? type and confirm a new password/) do
  @password = SecureRandom.hex(12)
  step %Q(I type "#{@password}")
  step %Q(I type "#{@password}")
  step "the exit status should be 0"
end

When(/^I enter the password/) do
  raise "No current password" unless @password
  step %Q(I type "#{@password}")
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
conjur-cli-5.2.5 acceptance-features/step_definitions/user_steps.rb
conjur-cli-5.2.4 acceptance-features/step_definitions/user_steps.rb
conjur-cli-5.2.3 acceptance-features/step_definitions/user_steps.rb
conjur-cli-5.2.1 acceptance-features/step_definitions/user_steps.rb
conjur-cli-5.2.0 acceptance-features/step_definitions/user_steps.rb
conjur-cli-5.1.2 acceptance-features/step_definitions/user_steps.rb
conjur-cli-5.1.1 acceptance-features/step_definitions/user_steps.rb
conjur-cli-5.1.0 acceptance-features/step_definitions/user_steps.rb
conjur-cli-4.30.1 acceptance-features/step_definitions/user_steps.rb
conjur-cli-4.30.0 acceptance-features/step_definitions/user_steps.rb
conjur-cli-4.29.0 acceptance-features/step_definitions/user_steps.rb