From 068a609dee65e023ff102ac199604d5776c6ac39 Mon Sep 17 00:00:00 2001 From: Brandon Dunne Date: Fri, 19 May 2017 09:11:52 -0400 Subject: [PATCH] Add test for Host#refresh_linux_packages Based on https://github.com/ManageIQ/manageiq/pull/15140 --- spec/models/host_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/models/host_spec.rb b/spec/models/host_spec.rb index 045886fe772..3d86290e5cd 100644 --- a/spec/models/host_spec.rb +++ b/spec/models/host_spec.rb @@ -652,4 +652,20 @@ def assert_remote_credentials_validated MiqQueue.first.delivered(status, message, MiqAeEngine::MiqAeWorkspaceRuntime.new) end end + + context "#refresh_linux_packages" do + it "with utf-8 characters (like trademark)" do + rpm_list = "iwl3945-firmware|15.32.2.9|noarch|System Environment/Kernel|43.el7|Firmware for IntelĀ® PRO/Wireless 3945 A/B/G network adaptors" + mock_ssu = double("SSU", :shell_exec => rpm_list) + + expect(GuestApplication).to receive(:add_elements) do |_host, xml| + require 'nokogiri' + expect(Nokogiri::Slop(xml.to_s).miq.software.applications.children.first.attributes["description"].value).to eq( + "Firmware for IntelĀ® PRO/Wireless 3945 A/B/G network adaptors" + ) + end + + described_class.new.refresh_linux_packages(mock_ssu) + end + end end