Sha256: 7f2afb1da47152a03d9a2387d75406d603fde31256e1f8a6c01b50222971e084
Contents?: true
Size: 1.64 KB
Versions: 18
Compression:
Stored size: 1.64 KB
Contents
require 'test_plugin_helper' class AnsibleReportsHelperTest < ActiveSupport::TestCase include ForemanAnsible::AnsibleReportsHelper include ActionView::Helpers::TagHelper test 'is able to print a string instead of a hash' do log_value = <<-ANSIBLELOG.strip_heredoc {"_ansible_parsed": true, "_ansible_no_log": false, "changed": false, "results": ["ntp-4.2.8p10-3.fc27.x86_64 providing ntp is already installed"], "rc": 0, "invocation": {"module_args": {"allow_downgrade": false, "name": ["ntp"], "list": null, "disable_gpg_check": false, "conf_file": null, "install_repoquery": true, "state": "installed", "disablerepo": null, "update_cache": false, "enablerepo": null, "exclude": null, "security": false, "validate_certs": true, "installroot": "/", "skip_broken": false}}, "msg": ""} ANSIBLELOG message = FactoryBot.build(:message) message.value = log_value log = FactoryBot.build(:log) log.message = message assert_match( /ntp-4.2.8p10-3.fc27.x86_64 providing ntp is already installed/, module_invocations(parsed_message_json(log)).to_s ) end test 'pretty print is able to print a hash' do hash = { 'allow_downgrade' => false, 'name' => ['ntp'], 'list' => nil, 'disable_gpg_check' => false, 'conf_file' => nil, 'install_repoquery' => true, 'state' => 'installed', 'disablerepo' => nil, 'update_cache' => false, 'enablerepo' => nil, 'exclude' => nil, 'security' => false, 'validate_certs' => true, 'installroot' => '/', 'skip_broken' => false } assert_equal( hash, remove_keys( hash ) ) end end
Version data entries
18 entries across 18 versions & 1 rubygems