<commit_before>World(Rack::Test::Methods)

Given /^I am a valid API user$/ do
  @user = Factory(:user)
  unless admin_role = Role.find_by_name('admin')
    admin_role = Role.create(:name => 'admin')
  end

  unless @user.roles(&:name).include?('admin')
    @user.roles << admin_role
  end

  authorize @user.authentication_token, "X"
end

Given /^I send and accept json$/ do
  #header 'AUTHORIZATION', "#{@user.authentication_token}:X"
  header "Content-Type","application/json"
  header "Accept","application/json"
end

private

def encode_credentials(username, password)
  req = Net::HTTP::Get.new('/api/orders/8567520/shipments')
  req.basic_auth(@user.authentication_token,"x")
  return req['authorization'].gsub(/Basic\w/, "")
  #ActionController::HttpAuthentication::Basic.encode_credentials(username,password)
  #{}"Basic " + Base64.encode64("#{username}:#{password}").gsub(/\r\n/m, "")
end
<commit_msg>Removed some defunct test stuff<commit_after>World(Rack::Test::Methods)

Given /^I am a valid API user$/ do
  @user = Factory(:user)
  unless admin_role = Role.find_by_name('admin')
    admin_role = Role.create(:name => 'admin')
  end

  unless @user.roles(&:name).include?('admin')
    @user.roles << admin_role
  end

  authorize @user.authentication_token, "X"
end

Given /^I send and accept json$/ do
  header "Content-Type","application/json"
  header "Accept","application/json"
end
{'fraction_non_alphanumeric': 0.16380543633762518, 'fraction_numerical': 0.007868383404864092, 'mean_word_length': 5.135964912280702, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5617214', 'n_tokens_mistral': 489, 'n_tokens_neox': 471, 'n_words': 98}