hammer_cli_foreman 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/configuration.md +2 -2
- data/doc/name_id_resolution.md +26 -1
- data/doc/release_notes.md +24 -0
- data/lib/hammer_cli_foreman.rb +30 -29
- data/lib/hammer_cli_foreman/api/connection.rb +1 -1
- data/lib/hammer_cli_foreman/api/interactive_basic_auth.rb +3 -3
- data/lib/hammer_cli_foreman/api/session_authenticator_wrapper.rb +9 -8
- data/lib/hammer_cli_foreman/api/void_auth.rb +7 -0
- data/lib/hammer_cli_foreman/architecture.rb +3 -5
- data/lib/hammer_cli_foreman/associating_commands.rb +32 -32
- data/lib/hammer_cli_foreman/auth.rb +2 -2
- data/lib/hammer_cli_foreman/auth_source_ldap.rb +4 -4
- data/lib/hammer_cli_foreman/commands.rb +23 -55
- data/lib/hammer_cli_foreman/common_parameter.rb +5 -5
- data/lib/hammer_cli_foreman/compute_resource.rb +17 -7
- data/lib/hammer_cli_foreman/config_group.rb +3 -3
- data/lib/hammer_cli_foreman/domain.rb +6 -8
- data/lib/hammer_cli_foreman/environment.rb +3 -3
- data/lib/hammer_cli_foreman/exception_handler.rb +27 -4
- data/lib/hammer_cli_foreman/external_usergroup.rb +3 -4
- data/lib/hammer_cli_foreman/filter.rb +20 -21
- data/lib/hammer_cli_foreman/host.rb +43 -18
- data/lib/hammer_cli_foreman/hostgroup.rb +24 -19
- data/lib/hammer_cli_foreman/hosts/common_update_options.rb +4 -6
- data/lib/hammer_cli_foreman/id_resolver.rb +86 -50
- data/lib/hammer_cli_foreman/image.rb +3 -4
- data/lib/hammer_cli_foreman/interface.rb +7 -9
- data/lib/hammer_cli_foreman/location.rb +6 -9
- data/lib/hammer_cli_foreman/media.rb +3 -6
- data/lib/hammer_cli_foreman/model.rb +3 -6
- data/lib/hammer_cli_foreman/operating_system.rb +11 -12
- data/lib/hammer_cli_foreman/option_sources.rb +4 -0
- data/lib/hammer_cli_foreman/option_sources/id_params.rb +51 -0
- data/lib/hammer_cli_foreman/option_sources/ids_params.rb +30 -0
- data/lib/hammer_cli_foreman/option_sources/self_param.rb +16 -0
- data/lib/hammer_cli_foreman/option_sources/user_params.rb +59 -0
- data/lib/hammer_cli_foreman/organization.rb +6 -9
- data/lib/hammer_cli_foreman/output/formatters.rb +1 -1
- data/lib/hammer_cli_foreman/parameter.rb +3 -5
- data/lib/hammer_cli_foreman/partition_table.rb +5 -6
- data/lib/hammer_cli_foreman/realm.rb +3 -3
- data/lib/hammer_cli_foreman/report.rb +1 -4
- data/lib/hammer_cli_foreman/role.rb +4 -7
- data/lib/hammer_cli_foreman/settings.rb +1 -1
- data/lib/hammer_cli_foreman/smart_class_parameter.rb +24 -14
- data/lib/hammer_cli_foreman/smart_proxy.rb +5 -7
- data/lib/hammer_cli_foreman/smart_variable.rb +24 -12
- data/lib/hammer_cli_foreman/ssh_keys.rb +56 -0
- data/lib/hammer_cli_foreman/subnet.rb +6 -9
- data/lib/hammer_cli_foreman/template.rb +16 -9
- data/lib/hammer_cli_foreman/user.rb +10 -52
- data/lib/hammer_cli_foreman/usergroup.rb +3 -3
- data/lib/hammer_cli_foreman/version.rb +1 -1
- data/test/data/1.15/foreman_api.json +1 -1
- data/test/data/1.16/foreman_api.json +1 -0
- data/test/functional/compute_resource_test.rb +117 -0
- data/test/functional/filter_test.rb +2 -2
- data/test/functional/host_test.rb +61 -10
- data/test/functional/location_test.rb +5 -5
- data/test/functional/organization_test.rb +7 -7
- data/test/functional/role_test.rb +3 -3
- data/test/functional/smart_class_parameter_test.rb +5 -5
- data/test/functional/smart_variable_test.rb +1 -1
- data/test/functional/ssh_keys_test.rb +105 -0
- data/test/functional/template_test.rb +30 -4
- data/test/functional/user_test.rb +5 -5
- data/test/reports/TEST-HammerCLIForeman-Architecture-CreateCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Architecture-CreateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Architecture-DeleteCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Architecture-DeleteCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Architecture-InfoCommand-output.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Architecture-InfoCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Architecture-InfoCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Architecture-ListCommand-output.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Architecture-ListCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Architecture-ListCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Architecture-UpdateCommand-parameters.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-Architecture-UpdateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Architecture.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-CommonParameter-DeleteCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-CommonParameter-DeleteCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-CommonParameter-ListCommand-output.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-CommonParameter-ListCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-CommonParameter-ListCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-CommonParameter-SetCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-CommonParameter-SetCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-CommonParameter.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-CreateCommand-parameters.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-CreateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-DeleteCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-DeleteCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-InfoCommand-output.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-InfoCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-InfoCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-ListCommand-output.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-ListCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-ListCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-UpdateCommand-parameters.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-UpdateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-ComputeResource.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Domain-CreateCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Domain-CreateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Domain-DeleteCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Domain-DeleteCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Domain-DeleteParameterCommand-parameters.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-Domain-DeleteParameterCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Domain-InfoCommand-output.xml +21 -0
- data/test/reports/TEST-HammerCLIForeman-Domain-InfoCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Domain-InfoCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Domain-ListCommand-output.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Domain-ListCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Domain-ListCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Domain-SetParameterCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Domain-SetParameterCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Domain-UpdateCommand-parameters.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-Domain-UpdateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Domain.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Environment-CreateCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Environment-CreateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Environment-DeleteCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Environment-DeleteCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Environment-InfoCommand-output.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Environment-InfoCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Environment-InfoCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Environment-ListCommand-output.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Environment-ListCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Environment-ListCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Environment-UpdateCommand-parameters.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-Environment-UpdateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Environment.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-ExceptionHandler.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Host-CreateCommand-parameters.xml +46 -0
- data/test/reports/TEST-HammerCLIForeman-Host-CreateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Host-DeleteCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Host-DeleteCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Host-DeleteParameterCommand-parameters.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-Host-DeleteParameterCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Host-InfoCommand-output.xml +85 -0
- data/test/reports/TEST-HammerCLIForeman-Host-InfoCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Host-InfoCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Host-ListCommand-output.xml +21 -0
- data/test/reports/TEST-HammerCLIForeman-Host-ListCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Host-ListCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Host-PuppetRunCommand-output.xml +9 -0
- data/test/reports/TEST-HammerCLIForeman-Host-PuppetRunCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Host-SetParameterCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Host-SetParameterCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Host-StatusCommand-output.xml +9 -0
- data/test/reports/TEST-HammerCLIForeman-Host-StatusCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Host-UpdateCommand-parameters.xml +40 -0
- data/test/reports/TEST-HammerCLIForeman-Host-UpdateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Host.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-CreateCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-CreateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-DeleteCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-DeleteCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-DeleteParameterCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-DeleteParameterCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-InfoCommand-output.xml +29 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-InfoCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-InfoCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-ListCommand-output.xml +27 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-ListCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-ListCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-SetParameterCommand-parameters.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-SetParameterCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-UpdateCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-UpdateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Hostgroup.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Location-CreateCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Location-CreateCommand-resource-disabled.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Location-CreateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Location-DeleteCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Location-DeleteCommand-resource-disabled.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Location-DeleteCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Location-InfoCommand-output.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Location-InfoCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Location-InfoCommand-resource-disabled.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Location-InfoCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Location-ListCommand-output.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Location-ListCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Location-ListCommand-resource-disabled.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Location-ListCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Location-UpdateCommand-parameters.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-Location-UpdateCommand-resource-disabled.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Location-UpdateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Location.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Medium-CreateCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Medium-CreateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Medium-DeleteCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Medium-DeleteCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Medium-InfoCommand-output.xml +23 -0
- data/test/reports/TEST-HammerCLIForeman-Medium-InfoCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Medium-InfoCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Medium-ListCommand-output.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-Medium-ListCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Medium-ListCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Medium-UpdateCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Medium-UpdateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Medium.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-CreateCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-CreateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-DeleteCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-DeleteCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-DeleteParameterCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-DeleteParameterCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-InfoCommand-output.xml +27 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-InfoCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-InfoCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-ListCommand-output.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-ListCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-ListCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-SetParameterCommand-parameters.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-SetParameterCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-UpdateCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-UpdateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-CreateCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-CreateCommand-resource-disabled.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-CreateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-DeleteCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-DeleteCommand-resource-disabled.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-DeleteCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-InfoCommand-output.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-InfoCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-InfoCommand-resource-disabled.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-InfoCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-ListCommand-output.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-ListCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-ListCommand-resource-disabled.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-ListCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-UpdateCommand-parameters.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-UpdateCommand-resource-disabled.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Organization-UpdateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Organization.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-CreateCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-CreateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-DeleteCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-DeleteCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-DumpCommand-parameters.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-DumpCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-InfoCommand-output.xml +19 -0
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-InfoCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-InfoCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-ListCommand-output.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-ListCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-ListCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-UpdateCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-UpdateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-PartitionTable.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-CreateCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-CreateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-DeleteCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-DeleteCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-InfoCommand-output.xml +21 -0
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-InfoCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-InfoCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-ListCommand-output.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-ListCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-ListCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-UpdateCommand-parameters.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-UpdateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-SmartProxy.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Subnet-CreateCommand-parameters.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-Subnet-CreateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Subnet-DeleteCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Subnet-DeleteCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Subnet-InfoCommand-output.xml +43 -0
- data/test/reports/TEST-HammerCLIForeman-Subnet-InfoCommand-parameters.xml +13 -0
- data/test/reports/TEST-HammerCLIForeman-Subnet-InfoCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Subnet-ListCommand-output.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Subnet-ListCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Subnet-ListCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Subnet-UpdateCommand-parameters.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-Subnet-UpdateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Subnet.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Template-CreateCommand-parameters.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-Template-CreateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Template-DeleteCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Template-DeleteCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Template-DumpCommand-parameters.xml +12 -0
- data/test/reports/TEST-HammerCLIForeman-Template-DumpCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Template-InfoCommand-output.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Template-InfoCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Template-InfoCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Template-ListCommand-output.xml +15 -0
- data/test/reports/TEST-HammerCLIForeman-Template-ListCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-Template-ListCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Template-ListKindsCommand-parameters.xml +9 -0
- data/test/reports/TEST-HammerCLIForeman-Template-ListKindsCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Template-UpdateCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-Template-UpdateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-Template.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-User-CreateCommand-parameters.xml +19 -0
- data/test/reports/TEST-HammerCLIForeman-User-CreateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-User-DeleteCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-User-DeleteCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-User-InfoCommand-output.xml +23 -0
- data/test/reports/TEST-HammerCLIForeman-User-InfoCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-User-InfoCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-User-ListCommand-output.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-User-ListCommand-parameters.xml +17 -0
- data/test/reports/TEST-HammerCLIForeman-User-ListCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-User-UpdateCommand-parameters.xml +11 -0
- data/test/reports/TEST-HammerCLIForeman-User-UpdateCommand.xml +7 -0
- data/test/reports/TEST-HammerCLIForeman-User.xml +7 -0
- data/test/reports/TEST-MiniTest-Spec.xml +7 -0
- data/test/unit/api/interactive_basic_auth_test.rb +20 -1
- data/test/unit/api/session_authenticator_wrapper_test.rb +23 -8
- data/test/unit/api/void_auth_test.rb +11 -0
- data/test/unit/commands_test.rb +1 -1
- data/test/unit/exception_handler_test.rb +24 -3
- data/test/unit/helpers/command.rb +6 -2
- data/test/unit/host_test.rb +2 -2
- data/test/unit/hostgroup_test.rb +5 -3
- data/test/unit/id_resolver_test.rb +53 -5
- data/test/unit/media_test.rb +2 -2
- data/test/unit/option_sources/id_params_test.rb +30 -0
- data/test/unit/option_sources/ids_params_test.rb +30 -0
- data/test/unit/output/formatters_test.rb +4 -0
- data/test/unit/smart_class_parameter_test.rb +4 -4
- data/test/unit/smart_variable_test.rb +2 -2
- data/test/unit/user_test.rb +1 -2
- metadata +569 -69
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<testsuite name="HammerCLIForeman::Template::ListKindsCommand::parameters" tests="1" time="0.002669237" failures="0" errors="0" skipped="0" assertions="1">
|
3
|
+
<testcase name="test_0001_should accept no arguments" time="0.0023816" assertions="1">
|
4
|
+
</testcase>
|
5
|
+
<system-out>
|
6
|
+
</system-out>
|
7
|
+
<system-err>
|
8
|
+
</system-err>
|
9
|
+
</testsuite>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<testsuite name="HammerCLIForeman::Template::UpdateCommand::parameters" tests="2" time="0.006998183" failures="0" errors="0" skipped="0" assertions="2">
|
3
|
+
<testcase name="test_0002_should fail with id missing" time="0.00309061" assertions="1">
|
4
|
+
</testcase>
|
5
|
+
<testcase name="test_0001_should accept id, name, file, type, audit comment, os ids" time="0.003626329" assertions="1">
|
6
|
+
</testcase>
|
7
|
+
<system-out>
|
8
|
+
</system-out>
|
9
|
+
<system-err>
|
10
|
+
</system-err>
|
11
|
+
</testsuite>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<testsuite name="HammerCLIForeman::User::CreateCommand::parameters" tests="6" time="0.070330632" failures="0" errors="0" skipped="0" assertions="6">
|
3
|
+
<testcase name="test_0005_should fail with password missing" time="0.001987686" assertions="1">
|
4
|
+
</testcase>
|
5
|
+
<testcase name="test_0001_should accept all required" time="0.026994394" assertions="1">
|
6
|
+
</testcase>
|
7
|
+
<testcase name="test_0004_should fail with mail missing" time="0.001736479" assertions="1">
|
8
|
+
</testcase>
|
9
|
+
<testcase name="test_0003_should fail with login missing" time="0.001538005" assertions="1">
|
10
|
+
</testcase>
|
11
|
+
<testcase name="test_0002_should accept all required plus names" time="0.035799589" assertions="1">
|
12
|
+
</testcase>
|
13
|
+
<testcase name="test_0006_should fail with auth source missing" time="0.001916041" assertions="1">
|
14
|
+
</testcase>
|
15
|
+
<system-out>
|
16
|
+
</system-out>
|
17
|
+
<system-err>
|
18
|
+
</system-err>
|
19
|
+
</testsuite>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<testsuite name="HammerCLIForeman::User::DeleteCommand::parameters" tests="2" time="0.005474158" failures="0" errors="0" skipped="0" assertions="2">
|
3
|
+
<testcase name="test_0001_should accept id" time="0.003096329" assertions="1">
|
4
|
+
</testcase>
|
5
|
+
<testcase name="test_0002_should fail with id missing" time="0.002057597" assertions="1">
|
6
|
+
</testcase>
|
7
|
+
<system-out>
|
8
|
+
</system-out>
|
9
|
+
<system-err>
|
10
|
+
</system-err>
|
11
|
+
</testsuite>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<testsuite name="HammerCLIForeman::User::InfoCommand::output" tests="8" time="0.070991386" failures="0" errors="0" skipped="0" assertions="15">
|
3
|
+
<testcase name="test_0006_should print column Last login" time="0.006886969" assertions="2">
|
4
|
+
</testcase>
|
5
|
+
<testcase name="test_0007_should print column Created at" time="0.005724051" assertions="2">
|
6
|
+
</testcase>
|
7
|
+
<testcase name="test_0002_should print column Id" time="0.005450286" assertions="2">
|
8
|
+
</testcase>
|
9
|
+
<testcase name="test_0005_should print column Email" time="0.005539803" assertions="2">
|
10
|
+
</testcase>
|
11
|
+
<testcase name="test_0001_should print 1 records" time="0.005695008" assertions="1">
|
12
|
+
</testcase>
|
13
|
+
<testcase name="test_0004_should print column Name" time="0.005614019" assertions="2">
|
14
|
+
</testcase>
|
15
|
+
<testcase name="test_0003_should print column Login" time="0.0054379" assertions="2">
|
16
|
+
</testcase>
|
17
|
+
<testcase name="test_0008_should print column Updated at" time="0.030227896" assertions="2">
|
18
|
+
</testcase>
|
19
|
+
<system-out>
|
20
|
+
</system-out>
|
21
|
+
<system-err>
|
22
|
+
</system-err>
|
23
|
+
</testsuite>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<testsuite name="HammerCLIForeman::User::InfoCommand::parameters" tests="2" time="0.007194698" failures="0" errors="0" skipped="0" assertions="2">
|
3
|
+
<testcase name="test_0002_should fail with no arguments" time="0.001961391" assertions="1">
|
4
|
+
</testcase>
|
5
|
+
<testcase name="test_0001_should accept id" time="0.004686151" assertions="1">
|
6
|
+
</testcase>
|
7
|
+
<system-out>
|
8
|
+
</system-out>
|
9
|
+
<system-err>
|
10
|
+
</system-err>
|
11
|
+
</testsuite>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<testsuite name="HammerCLIForeman::User::ListCommand::output" tests="5" time="0.040416447" failures="0" errors="0" skipped="0" assertions="9">
|
3
|
+
<testcase name="test_0001_should print records" time="0.008256648" assertions="1">
|
4
|
+
</testcase>
|
5
|
+
<testcase name="test_0002_should print column Id" time="0.007677963" assertions="2">
|
6
|
+
</testcase>
|
7
|
+
<testcase name="test_0004_should print column Name" time="0.007567883" assertions="2">
|
8
|
+
</testcase>
|
9
|
+
<testcase name="test_0003_should print column Login" time="0.008033693" assertions="2">
|
10
|
+
</testcase>
|
11
|
+
<testcase name="test_0005_should print column Email" time="0.008511567" assertions="2">
|
12
|
+
</testcase>
|
13
|
+
<system-out>
|
14
|
+
</system-out>
|
15
|
+
<system-err>
|
16
|
+
</system-err>
|
17
|
+
</testsuite>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<testsuite name="HammerCLIForeman::User::ListCommand::parameters" tests="5" time="0.062271328" failures="0" errors="0" skipped="0" assertions="5">
|
3
|
+
<testcase name="test_0001_should accept no arguments" time="0.006421526" assertions="1">
|
4
|
+
</testcase>
|
5
|
+
<testcase name="test_0002_should accept search" time="0.005973033" assertions="1">
|
6
|
+
</testcase>
|
7
|
+
<testcase name="test_0005_should accept order" time="0.037953243" assertions="1">
|
8
|
+
</testcase>
|
9
|
+
<testcase name="test_0004_should accept page" time="0.005649507" assertions="1">
|
10
|
+
</testcase>
|
11
|
+
<testcase name="test_0003_should accept per page" time="0.005632757" assertions="1">
|
12
|
+
</testcase>
|
13
|
+
<system-out>
|
14
|
+
</system-out>
|
15
|
+
<system-err>
|
16
|
+
</system-err>
|
17
|
+
</testsuite>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<testsuite name="HammerCLIForeman::User::UpdateCommand::parameters" tests="2" time="0.004924509" failures="0" errors="0" skipped="0" assertions="2">
|
3
|
+
<testcase name="test_0001_should accept id" time="0.002951368" assertions="1">
|
4
|
+
</testcase>
|
5
|
+
<testcase name="test_0002_should fail with no params" time="0.00166842" assertions="1">
|
6
|
+
</testcase>
|
7
|
+
<system-out>
|
8
|
+
</system-out>
|
9
|
+
<system-err>
|
10
|
+
</system-err>
|
11
|
+
</testsuite>
|
@@ -73,7 +73,7 @@ describe HammerCLIForeman::Api::InteractiveBasicAuth do
|
|
73
73
|
ex = RestClient::Unauthorized.new
|
74
74
|
new_ex = auth.error(ex)
|
75
75
|
|
76
|
-
assert_equal 'Invalid username or password', new_ex.message
|
76
|
+
assert_equal 'Invalid username or password.', new_ex.message
|
77
77
|
end
|
78
78
|
|
79
79
|
it 'does not override other exceptions' do
|
@@ -101,4 +101,23 @@ describe HammerCLIForeman::Api::InteractiveBasicAuth do
|
|
101
101
|
assert_nil auth.user
|
102
102
|
end
|
103
103
|
end
|
104
|
+
|
105
|
+
describe '#status' do
|
106
|
+
let(:auth) { HammerCLIForeman::Api::InteractiveBasicAuth.new(nil, nil) }
|
107
|
+
|
108
|
+
it 'says user is logged only when both username and password are present' do
|
109
|
+
auth.set_credentials('admin', 'password')
|
110
|
+
assert_equal "Using configured credentials for user 'admin'.", auth.status
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'says user is not logged when only username is present' do
|
114
|
+
auth.set_credentials('admin', nil)
|
115
|
+
assert_equal "Credentials are not configured.", auth.status
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'says user is not logged when only password is present' do
|
119
|
+
auth.set_credentials(nil, 'password')
|
120
|
+
assert_equal "Credentials are not configured.", auth.status
|
121
|
+
end
|
122
|
+
end
|
104
123
|
end
|
@@ -172,7 +172,7 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
172
172
|
ex = RestClient::Unauthorized.new
|
173
173
|
new_ex = auth.error(ex)
|
174
174
|
|
175
|
-
assert_equal 'Session has expired', new_ex.message
|
175
|
+
assert_equal 'Session has expired.', new_ex.message
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
@@ -203,7 +203,7 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
203
203
|
ex = RestClient::Unauthorized.new
|
204
204
|
new_ex = auth.error(ex)
|
205
205
|
|
206
|
-
assert_equal "Invalid username or password, continuing with session for 'admin'", new_ex.message
|
206
|
+
assert_equal "Invalid username or password, continuing with session for 'admin'.", new_ex.message
|
207
207
|
end
|
208
208
|
end
|
209
209
|
|
@@ -224,18 +224,18 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
224
224
|
prepare_session_storage do |auth, dir|
|
225
225
|
ex = RestClient::Unauthorized.new
|
226
226
|
|
227
|
-
wrapped_auth.expects(:error).with(ex)
|
228
|
-
auth.error(ex)
|
227
|
+
wrapped_auth.expects(:error).with(ex).returns(:new_exception)
|
228
|
+
assert_equal(:new_exception, auth.error(ex))
|
229
229
|
end
|
230
230
|
end
|
231
231
|
|
232
232
|
it 'keeps error message for other exceptions' do
|
233
233
|
prepare_session_storage do |auth, dir|
|
234
234
|
ex = RuntimeError.new('Some error')
|
235
|
-
wrapped_auth.expects(:error).with(ex)
|
236
|
-
auth.error(ex)
|
235
|
+
wrapped_auth.expects(:error).with(ex).returns(ex)
|
236
|
+
new_ex = auth.error(ex)
|
237
237
|
|
238
|
-
assert_equal 'Some error',
|
238
|
+
assert_equal 'Some error', new_ex.message
|
239
239
|
end
|
240
240
|
end
|
241
241
|
end
|
@@ -283,12 +283,13 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
283
283
|
|
284
284
|
it "ignores unauthorized requests" do
|
285
285
|
prepare_session_storage do |auth, dir|
|
286
|
-
resp = stub(:cookies => {}, :code => 401)
|
286
|
+
resp = stub(:cookies => {'_session_id' => 'NEW_SESSION_ID'}, :code => 401)
|
287
287
|
|
288
288
|
wrapped_auth.expects(:response).with(resp)
|
289
289
|
auth.response(resp)
|
290
290
|
|
291
291
|
refute File.exist?(session_file(dir))
|
292
|
+
assert_nil auth.session_id
|
292
293
|
end
|
293
294
|
end
|
294
295
|
end
|
@@ -354,4 +355,18 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
354
355
|
end
|
355
356
|
end
|
356
357
|
end
|
358
|
+
|
359
|
+
describe '#status' do
|
360
|
+
it 'informs that there is no existing session' do
|
361
|
+
prepare_session_storage do |auth, dir|
|
362
|
+
assert_equal "Using sessions, you are currently not logged in.", auth.status
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
it "informas about existing session" do
|
367
|
+
prepare_session_storage :session_id => 'SOME_SESSION_ID' do |auth, dir|
|
368
|
+
assert_equal "Session exists, currently logged in as 'admin'.", auth.status
|
369
|
+
end
|
370
|
+
end
|
371
|
+
end
|
357
372
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '../test_helper')
|
2
|
+
|
3
|
+
describe HammerCLIForeman::Api::VoidAuth do
|
4
|
+
describe '#status' do
|
5
|
+
it "returns a configured status message" do
|
6
|
+
msg = 'Some message'
|
7
|
+
auth = HammerCLIForeman::Api::VoidAuth.new(msg)
|
8
|
+
assert_equal msg, auth.status
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/test/unit/commands_test.rb
CHANGED
@@ -93,7 +93,7 @@ describe HammerCLIForeman do
|
|
93
93
|
})
|
94
94
|
arch = HammerCLIForeman::Architecture::CreateCommand.new("", { :adapter => :csv, :interactive => false })
|
95
95
|
out, err = capture_io { arch.run(["--name='i386'"]) }
|
96
|
-
out.must_match("Message,Id,Name\nArchitecture created
|
96
|
+
out.must_match("Message,Id,Name\nArchitecture created.,3,i386\n")
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
@@ -38,11 +38,21 @@ describe HammerCLIForeman::ExceptionHandler do
|
|
38
38
|
|
39
39
|
it "should handle forbidden error" do
|
40
40
|
ex = RestClient::Forbidden.new
|
41
|
-
output.expects(:print_error).with('Forbidden - server refused to process the request', nil)
|
41
|
+
output.expects(:print_error).with('Forbidden - server refused to process the request.', nil)
|
42
42
|
err_code = handler.handle_exception(ex)
|
43
43
|
err_code.must_equal HammerCLI::EX_NOPERM
|
44
44
|
end
|
45
45
|
|
46
|
+
it "handles forbidden error with permission details" do
|
47
|
+
response = <<-RESPONSE
|
48
|
+
{"error":{"message":"Access denied", "details": "You're missing permission view_hosts"}}
|
49
|
+
RESPONSE
|
50
|
+
ex = RestClient::Forbidden.new(response)
|
51
|
+
ex.message = 'Forbidden'
|
52
|
+
output.expects(:print_error).with("Access denied\nYou're missing permission view_hosts", nil)
|
53
|
+
assert_equal(HammerCLI::EX_NOPERM, handler.handle_exception(ex))
|
54
|
+
end
|
55
|
+
|
46
56
|
it "should handle unknown exception" do
|
47
57
|
output.expects(:print_error).with(heading, "Error: message")
|
48
58
|
MyException = Class.new(Exception)
|
@@ -121,7 +131,7 @@ describe HammerCLIForeman::ExceptionHandler do
|
|
121
131
|
response.headers[:location] = 'https://foreman.example.com/api/architectures'
|
122
132
|
ex = RestClient::MovedPermanently.new(response)
|
123
133
|
|
124
|
-
output.expects(:print_error).with(heading, "Redirection of API call detected.\nIt seems hammer is configured to use HTTP and the server prefers HTTPS.\nUpdate your server url configuration
|
134
|
+
output.expects(:print_error).with(heading, "Redirection of API call detected.\nIt seems hammer is configured to use HTTP and the server prefers HTTPS.\nUpdate your server url configuration.\nYou can set 'follow_redirects' to one of :default or :always to enable redirects following.")
|
125
135
|
err_code = handler.handle_exception(ex, :heading => heading)
|
126
136
|
err_code.must_equal HammerCLI::EX_CONFIG
|
127
137
|
end
|
@@ -130,9 +140,20 @@ describe HammerCLIForeman::ExceptionHandler do
|
|
130
140
|
response.headers[:location] = 'http://foreman.example.com/api/other_resource'
|
131
141
|
ex = RestClient::MovedPermanently.new(response)
|
132
142
|
|
133
|
-
output.expects(:print_error).with(heading, "Redirection of API call detected.\nUpdate your server url configuration
|
143
|
+
output.expects(:print_error).with(heading, "Redirection of API call detected.\nUpdate your server url configuration.\nYou can set 'follow_redirects' to one of :default or :always to enable redirects following.")
|
134
144
|
err_code = handler.handle_exception(ex, :heading => heading)
|
135
145
|
err_code.must_equal HammerCLI::EX_CONFIG
|
136
146
|
end
|
137
147
|
end
|
148
|
+
|
149
|
+
it "should gracefully handle bad requests and show message from response" do
|
150
|
+
response = <<-RESPONSE
|
151
|
+
{"error":{"message":"some field is missing"}}
|
152
|
+
RESPONSE
|
153
|
+
|
154
|
+
ex = RestClient::BadRequest.new(response)
|
155
|
+
ex.message = 'Bad Request'
|
156
|
+
output.expects(:print_error).with("Bad Request\n some field is missing", nil)
|
157
|
+
assert_equal(HammerCLI::EX_DATAERR, handler.handle_exception(ex))
|
158
|
+
end
|
138
159
|
end
|
@@ -9,8 +9,12 @@ class IdResolverTestProxy
|
|
9
9
|
define_id_finders
|
10
10
|
end
|
11
11
|
|
12
|
-
def scoped_options(scope, options)
|
13
|
-
@original_resolver.scoped_options(scope, options)
|
12
|
+
def scoped_options(scope, options, mode = nil)
|
13
|
+
@original_resolver.scoped_options(scope, options, mode)
|
14
|
+
end
|
15
|
+
|
16
|
+
def searchables(resource)
|
17
|
+
@original_resolver.searchables(resource)
|
14
18
|
end
|
15
19
|
|
16
20
|
protected
|
data/test/unit/host_test.rb
CHANGED
@@ -45,8 +45,8 @@ describe HammerCLIForeman::Host do
|
|
45
45
|
with_params ["--id=1"] do
|
46
46
|
it_should_print_n_records 1
|
47
47
|
it_should_print_columns ["Id", "Name", "Organization", "Location"]
|
48
|
-
it_should_print_columns ["Host Group", "Compute Resource", "Compute Profile", "Environment"]
|
49
|
-
it_should_print_columns ["Puppet CA
|
48
|
+
it_should_print_columns ["Host Group", "Compute Resource", "Compute Profile", "Puppet Environment"]
|
49
|
+
it_should_print_columns ["Puppet CA Proxy", "Puppet Master Proxy", "Cert name"]
|
50
50
|
it_should_print_columns ["Managed", "Installed at", "Last report"]
|
51
51
|
it_should_print_columns ["Network", "Network interfaces", "Operating system", "Parameters", "All parameters", "Additional info"]
|
52
52
|
end
|