<commit_before>require_relative '../interaction_methods'

require "spec_helper"

$LOAD_PATH << Rails.root.join("tools")

describe Openstack::InteractionMethods do
  let(:host1_data) { {:name => "name1", :connection_state => 'connection_state1', :settings => {}} }
  let(:host2_data) { {:name => "name2", :connection_state => 'connection_state2', :settings => {}} }
  let(:host3_data) { {:name => "name3", :connection_state => 'connection_state', :settings => {}} }
  let(:host4_data) { {:name => "name4", :connection_state => 'connection_state', :settings => {}} }
  let(:host5_data) do
    {
      :name             => "name5",
      :connection_state => 'connection_state5',
      :settings         => {
        :ip_addr => "192.168.3.11",
      }
    }
  end

  let(:host6_data) do
    {
      :name             => "name6",
      :connection_state => 'connection_state6',
      :settings         => {
        :ip_addr => "192.168.3.11",
        :gateway => "192.0.2.1",
      }
    }
  end

  let(:host7_data) do
    {
      :name             => "name7",
      :connection_state => 'connection_state7',
      :settings         => {
        :ip_addr => "172.16.58.3",
        :gateway => "192.0.2.2",
      }
    }
  end

  let(:host1) { FactoryGirl.create(:host, host1_data) }
  let(:host2) { FactoryGirl.create(:host, host2_data) }
  let(:host3) { FactoryGirl.create(:host, host3_data) }
  let(:host4) { FactoryGirl.create(:host, host4_data) }
  let(:host5) { FactoryGirl.create(:host, host5_data) }
  let(:host6) { FactoryGirl.create(:host, host6_data) }
  let(:host7) { FactoryGirl.create(:host, host7_data) }

  let(:data) do
    [
      host1,<commit_msg>Extend test for interaction helpers<commit_after>require_relative '../interaction_methods'

require "spec_helper"

$LOAD_PATH << Rails.root.join("tools")

describe Openstack::InteractionMethods do
  let(:host1_data) { {:name => "name1", :connection_state => 'connection_state1', :settings => {}} }
  let(:host2_data) { {:name => "name2", :connection_state => 'connection_state2', :settings => {}} }
  let(:host3_data) { {:name => "name3", :connection_state => 'connection_state', :settings => {}} }
  let(:host4_data) { {:name => "name4", :connection_state => 'connection_state', :settings => {}} }
  let(:host5_data) do
    {
      :name             => "name5",
      :connection_state => 'connection_state5',
      :settings         => {
        :ip_addr => "1.2.3.4",
      }
    }
  end

  let(:host6_data) do
    {
      :name             => "name6",
      :connection_state => 'connection_state6',
      :settings         => {
        :ip_addr => "192.168.3.11",
        :gateway => "192.0.2.1",
      }
    }
  end

  let(:host7_data) do
    {
      :name             => "name7",
      :connection_state => 'connection_state7',
      :settings         => {
        "ip_addr" => "1.2.3.5",
        "gateway" => "192.0.2.2",
      }
    }
  end

  let(:host1) { FactoryGirl.create(:host, host1_data) }
  let(:host2) { FactoryGirl.create(:host, host2_data) }
  let(:host3) { FactoryGirl.create(:host, host3_data) }
  let(:host4) { FactoryGirl.create(:host, host4_data) }
  let(:host5) { FactoryGirl.create(:host, host5_data) }
  let(:host6) { FactoryGirl.create(:host, host6_data) }
  let(:host7) { FactoryGirl.create(:host, host7_data) }

  let(:data) do
    [
      host1,
{'fraction_non_alphanumeric': 0.18198144268183178, 'fraction_numerical': 0.04040706375336726, 'mean_word_length': 2.845799769850403, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 10, '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': '141773', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1168, 'n_words': 185}