Sha256: 8e8ab9a32738776cfcd9855899c0304811f6e4fec1edc1fa5eac154cf1888a7e

Contents?: true

Size: 1.35 KB

Versions: 9

Compression:

Stored size: 1.35 KB

Contents

require_relative "test_helper.rb"

class LinkerTest < Minitest::Test
  def test_linker_link
    connection = Minitest::Mock.new
    faraday = Minitest::Mock.new
    response = Minitest::Mock.new

    device_config = {
      ip: "111.222.333",
      user: "user",
      password: "password",
      logger: Logger.new("/dev/null")
    }
    path = "/launch/dev?a=A&b=B%3AC&d=a%5Cb"
    options = 'a:A, b:B:C, d:a\b'

    connection.expect(:post, response, [path])
    faraday.expect(:headers, {})
    faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
    faraday.expect(:request, nil, [:multipart])
    faraday.expect(:request, nil, [:url_encoded])
    faraday.expect(:adapter, nil, [Faraday.default_adapter])
    response.expect(:success?, true)

    linker = RokuBuilder::Linker.new(**device_config)
    success = nil
    Faraday.stub(:new, connection, faraday) do
      success = linker.link(options: options)
    end

    assert success

    connection.verify
    faraday.verify
    response.verify
  end
  def test_linker_link_nothing
    device_config = {
      ip: "111.222.333",
      user: "user",
      password: "password",
      logger: Logger.new("/dev/null")
    }
    options = ''
    linker = RokuBuilder::Linker.new(**device_config)
    success = nil
    success = linker.link(options: options)

    assert !success

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
roku_builder-3.6.1 tests/roku_builder/linker_test.rb
roku_builder-3.6.0 tests/roku_builder/linker_test.rb
roku_builder-3.5.0 tests/roku_builder/linker_test.rb
roku_builder-3.4.4 tests/roku_builder/linker_test.rb
roku_builder-3.4.3 tests/roku_builder/linker_test.rb
roku_builder-3.4.2 tests/roku_builder/linker_test.rb
roku_builder-3.4.1 tests/roku_builder/linker_test.rb
roku_builder-3.4.0 tests/roku_builder/linker_test.rb
roku_builder-3.3.4 tests/roku_builder/linker_test.rb