Sha256: 6f801907bf2105dba05ee703440ab48e0f048e3d49d8bc708dffc612d69f659b

Contents?: true

Size: 981 Bytes

Versions: 1

Compression:

Stored size: 981 Bytes

Contents

require 'test_plugin_helper'

class MacGeneratorTest < ActiveSupport::TestCase
  setup do
    dir = File.expand_path('../../../data', __FILE__)
    @generator = ForemanNameGenerator::MacGenerator.new(dir)
  end

  test 'generates empty array for nil' do
    assert_equal [], @generator.generate(nil)
  end

  test 'generates empty array for empty string' do
    assert_equal [], @generator.generate("")
  end

  test 'generates a male name' do
    assert_equal ["DEREK", "LEVI", "PRATICO", "CEDILLO"], @generator.generate("00:00:ca:fe:01:01")
  end

  test 'generates a female name' do
    assert_equal ["KATHY", "ALTA", "ROMEO", "CEDILLO"], @generator.generate("00:01:ca:fe:01:01")
  end

  test 'generates same middle names for single OID' do
    name1 = @generator.generate("24:a4:3c:ec:76:06")
    name2 = @generator.generate("24:a4:3c:e3:d3:92")
    #puts name1.inspect
    #puts name2.inspect
    assert_equal name1[1], name2[1]
    assert_equal name1[2], name2[2]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_name_generator-0.0.2 test/unit/mac_generator_test.rb