hammer_cli_foreman 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of hammer_cli_foreman might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +13 -2
- data/doc/host_create.md +15 -7
- data/doc/release_notes.md +11 -0
- data/lib/hammer_cli_foreman/commands.rb +5 -1
- data/lib/hammer_cli_foreman/defaults.rb +29 -0
- data/lib/hammer_cli_foreman/host.rb +8 -1
- data/lib/hammer_cli_foreman/id_resolver.rb +1 -1
- data/lib/hammer_cli_foreman/location.rb +21 -0
- data/lib/hammer_cli_foreman/organization.rb +21 -0
- data/lib/hammer_cli_foreman/parameter.rb +7 -7
- data/lib/hammer_cli_foreman/role.rb +13 -0
- data/lib/hammer_cli_foreman/subnet.rb +1 -1
- data/lib/hammer_cli_foreman/version.rb +1 -1
- data/lib/hammer_cli_foreman.rb +2 -0
- data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/de/hammer-cli-foreman.edit.po +394 -423
- data/locale/de/hammer-cli-foreman.po +1920 -1511
- data/locale/en/hammer-cli-foreman.edit.po +188 -124
- data/locale/en/hammer-cli-foreman.po +49 -1
- data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en_GB/hammer-cli-foreman.edit.po +208 -152
- data/locale/en_GB/hammer-cli-foreman.po +1554 -1145
- data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/es/hammer-cli-foreman.edit.po +438 -464
- data/locale/es/hammer-cli-foreman.po +1930 -1519
- data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/fr/hammer-cli-foreman.edit.po +301 -328
- data/locale/fr/hammer-cli-foreman.po +1922 -1513
- data/locale/hammer-cli-foreman.pot +194 -127
- data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/it/hammer-cli-foreman.edit.po +303 -331
- data/locale/it/hammer-cli-foreman.po +1909 -1500
- data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ja/hammer-cli-foreman.edit.po +302 -330
- data/locale/ja/hammer-cli-foreman.po +1920 -1511
- data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ko/hammer-cli-foreman.edit.po +303 -332
- data/locale/ko/hammer-cli-foreman.po +1910 -1501
- data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/pt_BR/hammer-cli-foreman.edit.po +369 -393
- data/locale/pt_BR/hammer-cli-foreman.po +1916 -1506
- data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ru/hammer-cli-foreman.edit.po +344 -372
- data/locale/ru/hammer-cli-foreman.po +1940 -1531
- data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/zh_CN/hammer-cli-foreman.edit.po +303 -331
- data/locale/zh_CN/hammer-cli-foreman.po +1905 -1496
- data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/zh_TW/hammer-cli-foreman.edit.po +306 -334
- data/locale/zh_TW/hammer-cli-foreman.po +1908 -1499
- data/test/functional/api_expectations.rb +65 -0
- data/test/functional/command_assertions.rb +76 -0
- data/test/functional/location_test.rb +140 -0
- data/test/functional/organization_test.rb +140 -0
- data/test/functional/test_helper.rb +7 -0
- data/test/test_helper.rb +27 -0
- data/test/unit/apipie_resource_mock.rb +24 -6
- data/test/unit/architecture_test.rb +1 -1
- data/test/unit/auth_source_ldap_test.rb +1 -3
- data/test/unit/common_parameter_test.rb +1 -1
- data/test/unit/compute_resource_test.rb +1 -1
- data/test/unit/data/1.10/foreman_api.json +1 -0
- data/test/unit/data/README.md +22 -0
- data/test/unit/data/test_api.json +609 -0
- data/test/unit/defaults_test.rb +32 -0
- data/test/unit/dependency_resolver_test.rb +21 -16
- data/test/unit/domain_test.rb +1 -1
- data/test/unit/environment_test.rb +1 -1
- data/test/unit/external_usergroup_test.rb +1 -1
- data/test/unit/helpers/command.rb +5 -1
- data/test/unit/host_test.rb +16 -8
- data/test/unit/hostgroup_test.rb +1 -1
- data/test/unit/id_resolver_test.rb +40 -37
- data/test/unit/image_test.rb +1 -3
- data/test/unit/location_test.rb +1 -1
- data/test/unit/media_test.rb +3 -3
- data/test/unit/model_test.rb +1 -1
- data/test/unit/operating_system_test.rb +1 -2
- data/test/unit/option_builders_test.rb +106 -116
- data/test/unit/organization_test.rb +1 -1
- data/test/unit/partition_table_test.rb +1 -1
- data/test/unit/puppet_class_test.rb +4 -1
- data/test/unit/report_test.rb +1 -1
- data/test/unit/role_test.rb +15 -0
- data/test/unit/smart_class_parameter_test.rb +1 -1
- data/test/unit/smart_proxy_test.rb +1 -1
- data/test/unit/smart_variable_test.rb +1 -1
- data/test/unit/subnet_test.rb +1 -1
- data/test/unit/template_test.rb +1 -1
- data/test/unit/test_helper.rb +2 -29
- data/test/unit/user_test.rb +1 -2
- metadata +67 -539
- data/test/reports/TEST-HammerCLIForeman-Architecture-CreateCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Architecture-CreateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Architecture-DeleteCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Architecture-DeleteCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Architecture-InfoCommand-output.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Architecture-InfoCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Architecture-InfoCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Architecture-ListCommand-output.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Architecture-ListCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Architecture-ListCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Architecture-UpdateCommand-parameters.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-Architecture-UpdateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Architecture.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-CommonParameter-DeleteCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-CommonParameter-DeleteCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-CommonParameter-ListCommand-output.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-CommonParameter-ListCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-CommonParameter-ListCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-CommonParameter-SetCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-CommonParameter-SetCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-CommonParameter.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-CreateCommand-parameters.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-CreateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-DeleteCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-DeleteCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-InfoCommand-output.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-InfoCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-InfoCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-ListCommand-output.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-ListCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-ListCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-UpdateCommand-parameters.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-ComputeResource-UpdateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-ComputeResource.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Domain-CreateCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Domain-CreateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Domain-DeleteCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Domain-DeleteCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Domain-DeleteParameterCommand-parameters.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-Domain-DeleteParameterCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Domain-InfoCommand-output.xml +0 -21
- data/test/reports/TEST-HammerCLIForeman-Domain-InfoCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Domain-InfoCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Domain-ListCommand-output.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Domain-ListCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Domain-ListCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Domain-SetParameterCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Domain-SetParameterCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Domain-UpdateCommand-parameters.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-Domain-UpdateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Domain.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Environment-CreateCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Environment-CreateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Environment-DeleteCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Environment-DeleteCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Environment-InfoCommand-output.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Environment-InfoCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Environment-InfoCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Environment-ListCommand-output.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Environment-ListCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Environment-ListCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Environment-UpdateCommand-parameters.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-Environment-UpdateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Environment.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-ExceptionHandler.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Host-CreateCommand-parameters.xml +0 -46
- data/test/reports/TEST-HammerCLIForeman-Host-CreateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Host-DeleteCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Host-DeleteCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Host-DeleteParameterCommand-parameters.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-Host-DeleteParameterCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Host-InfoCommand-output.xml +0 -85
- data/test/reports/TEST-HammerCLIForeman-Host-InfoCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Host-InfoCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Host-ListCommand-output.xml +0 -21
- data/test/reports/TEST-HammerCLIForeman-Host-ListCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Host-ListCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Host-PuppetRunCommand-output.xml +0 -9
- data/test/reports/TEST-HammerCLIForeman-Host-PuppetRunCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Host-SetParameterCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Host-SetParameterCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Host-StatusCommand-output.xml +0 -9
- data/test/reports/TEST-HammerCLIForeman-Host-StatusCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Host-UpdateCommand-parameters.xml +0 -40
- data/test/reports/TEST-HammerCLIForeman-Host-UpdateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Host.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-CreateCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-CreateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-DeleteCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-DeleteCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-DeleteParameterCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-DeleteParameterCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-InfoCommand-output.xml +0 -29
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-InfoCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-InfoCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-ListCommand-output.xml +0 -27
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-ListCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-ListCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-SetParameterCommand-parameters.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-SetParameterCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-UpdateCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Hostgroup-UpdateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Hostgroup.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Location-CreateCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Location-CreateCommand-resource-disabled.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Location-CreateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Location-DeleteCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Location-DeleteCommand-resource-disabled.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Location-DeleteCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Location-InfoCommand-output.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Location-InfoCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Location-InfoCommand-resource-disabled.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Location-InfoCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Location-ListCommand-output.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Location-ListCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Location-ListCommand-resource-disabled.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Location-ListCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Location-UpdateCommand-parameters.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-Location-UpdateCommand-resource-disabled.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Location-UpdateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Location.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Medium-CreateCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Medium-CreateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Medium-DeleteCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Medium-DeleteCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Medium-InfoCommand-output.xml +0 -23
- data/test/reports/TEST-HammerCLIForeman-Medium-InfoCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Medium-InfoCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Medium-ListCommand-output.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-Medium-ListCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Medium-ListCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Medium-UpdateCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Medium-UpdateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Medium.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-CreateCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-CreateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-DeleteCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-DeleteCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-DeleteParameterCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-DeleteParameterCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-InfoCommand-output.xml +0 -27
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-InfoCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-InfoCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-ListCommand-output.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-ListCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-ListCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-SetParameterCommand-parameters.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-SetParameterCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-UpdateCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem-UpdateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-OperatingSystem.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Organization-CreateCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Organization-CreateCommand-resource-disabled.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Organization-CreateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Organization-DeleteCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Organization-DeleteCommand-resource-disabled.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Organization-DeleteCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Organization-InfoCommand-output.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Organization-InfoCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Organization-InfoCommand-resource-disabled.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Organization-InfoCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Organization-ListCommand-output.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Organization-ListCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Organization-ListCommand-resource-disabled.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Organization-ListCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Organization-UpdateCommand-parameters.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-Organization-UpdateCommand-resource-disabled.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Organization-UpdateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Organization.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-CreateCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-CreateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-DeleteCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-DeleteCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-DumpCommand-parameters.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-DumpCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-InfoCommand-output.xml +0 -19
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-InfoCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-InfoCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-ListCommand-output.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-ListCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-ListCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-UpdateCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-PartitionTable-UpdateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-PartitionTable.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-CreateCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-CreateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-DeleteCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-DeleteCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-InfoCommand-output.xml +0 -21
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-InfoCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-InfoCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-ListCommand-output.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-ListCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-ListCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-UpdateCommand-parameters.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-SmartProxy-UpdateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-SmartProxy.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Subnet-CreateCommand-parameters.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-Subnet-CreateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Subnet-DeleteCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Subnet-DeleteCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Subnet-InfoCommand-output.xml +0 -43
- data/test/reports/TEST-HammerCLIForeman-Subnet-InfoCommand-parameters.xml +0 -13
- data/test/reports/TEST-HammerCLIForeman-Subnet-InfoCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Subnet-ListCommand-output.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Subnet-ListCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Subnet-ListCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Subnet-UpdateCommand-parameters.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-Subnet-UpdateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Subnet.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Template-CreateCommand-parameters.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-Template-CreateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Template-DeleteCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Template-DeleteCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Template-DumpCommand-parameters.xml +0 -12
- data/test/reports/TEST-HammerCLIForeman-Template-DumpCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Template-InfoCommand-output.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Template-InfoCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Template-InfoCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Template-ListCommand-output.xml +0 -15
- data/test/reports/TEST-HammerCLIForeman-Template-ListCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-Template-ListCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Template-ListKindsCommand-parameters.xml +0 -9
- data/test/reports/TEST-HammerCLIForeman-Template-ListKindsCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Template-UpdateCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-Template-UpdateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-Template.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-User-CreateCommand-parameters.xml +0 -19
- data/test/reports/TEST-HammerCLIForeman-User-CreateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-User-DeleteCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-User-DeleteCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-User-InfoCommand-output.xml +0 -23
- data/test/reports/TEST-HammerCLIForeman-User-InfoCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-User-InfoCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-User-ListCommand-output.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-User-ListCommand-parameters.xml +0 -17
- data/test/reports/TEST-HammerCLIForeman-User-ListCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-User-UpdateCommand-parameters.xml +0 -11
- data/test/reports/TEST-HammerCLIForeman-User-UpdateCommand.xml +0 -7
- data/test/reports/TEST-HammerCLIForeman-User.xml +0 -7
- data/test/reports/TEST-MiniTest-Spec.xml +0 -7
- data/test/unit/data/1.4/foreman_api.json +0 -10387
- data/test/unit/data/1.5/foreman_api.json +0 -14130
- data/test/unit/data/1.6/foreman_api.json +0 -1
- data/test/unit/data/1.6/foreman_api_back.json +0 -1
- data/test/unit/data/1.6/whatever.json +0 -1
- data/test/unit/data/1.7/foreman_api.json +0 -1
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
+
describe HammerCLIForeman::Defaults do
|
3
|
+
|
4
|
+
context "Defaults" do
|
5
|
+
|
6
|
+
defaults_provider = HammerCLIForeman::Defaults.new
|
7
|
+
user = {"results" => ["default_organization" => {"id" => 2}, "default_location" => {"id" => 1}]}
|
8
|
+
empty_user = {"results" => ["default_organization" => nil, "default_location" => nil]}
|
9
|
+
|
10
|
+
it "returns defaults organization when exisits " do
|
11
|
+
defaults_provider.stubs(:get_user).returns user
|
12
|
+
assert_equal 2, defaults_provider.get_defaults(:organization_id)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "returns nil when defaults organization doesn't exisits " do
|
16
|
+
defaults_provider.stubs(:get_user).returns empty_user
|
17
|
+
assert_nil defaults_provider.get_defaults(:organization_id)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "returns defaults location when exisits " do
|
21
|
+
defaults_provider.stubs(:get_user).returns user
|
22
|
+
assert_equal 1, defaults_provider.get_defaults(:location_id)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "returns nil when defaults location doesn't exisits " do
|
26
|
+
defaults_provider.stubs(:get_user).returns empty_user
|
27
|
+
assert_nil defaults_provider.get_defaults(:location_id)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -4,41 +4,46 @@ require File.join(File.dirname(__FILE__), 'helpers/fake_searchables')
|
|
4
4
|
|
5
5
|
describe HammerCLIForeman::DependencyResolver do
|
6
6
|
|
7
|
+
let(:api) do ApipieBindings::API.new({
|
8
|
+
:apidoc_cache_dir => 'test/unit/data',
|
9
|
+
:apidoc_cache_name => 'test_api',
|
10
|
+
:dry_run => true})
|
11
|
+
end
|
12
|
+
|
13
|
+
before :each do
|
14
|
+
HammerCLIForeman.stubs(:foreman_api).returns(api)
|
15
|
+
end
|
16
|
+
|
7
17
|
let(:resolver) { HammerCLIForeman::DependencyResolver.new }
|
8
18
|
|
9
19
|
describe "for resource" do
|
10
20
|
|
11
21
|
it "returns empty array for an independent resource" do
|
12
|
-
resource =
|
22
|
+
resource = api.resource(:users)
|
13
23
|
resolver.resource_dependencies(resource).must_equal []
|
14
24
|
end
|
15
25
|
|
16
26
|
it "returns list of dependent resources" do
|
17
|
-
resource =
|
18
|
-
resolver.resource_dependencies(resource).map(&:name).sort_by{|sym| sym.to_s}.must_equal [
|
19
|
-
:compute_resources, :organizations, :locations
|
20
|
-
].sort_by{|sym| sym.to_s}
|
21
|
-
end
|
27
|
+
resource = api.resource(:comments)
|
22
28
|
|
29
|
+
resources = resolver.resource_dependencies(resource).map(&:name).sort_by{ |sym| sym.to_s }
|
30
|
+
expected = [:posts, :users]
|
31
|
+
resources.must_equal expected.sort_by{ |sym| sym.to_s }
|
32
|
+
end
|
23
33
|
end
|
24
34
|
|
25
35
|
describe "for action" do
|
26
36
|
|
27
37
|
it "returns empty array for an independent action" do
|
28
|
-
action = HammerCLIForeman.foreman_resource!(:
|
38
|
+
action = HammerCLIForeman.foreman_resource!(:users).action(:index)
|
29
39
|
resolver.action_dependencies(action).must_equal []
|
30
40
|
end
|
31
41
|
|
32
42
|
it "returns list of dependent resources" do
|
33
|
-
action = HammerCLIForeman.foreman_resource!(:
|
34
|
-
resolver.action_dependencies(action).map(&:name).sort_by{|sym| sym.to_s}
|
35
|
-
|
36
|
-
|
37
|
-
].sort_by{|sym| sym.to_s}
|
43
|
+
action = HammerCLIForeman.foreman_resource!(:comments).action(:create)
|
44
|
+
resources = resolver.action_dependencies(action).map(&:name).sort_by{ |sym| sym.to_s }
|
45
|
+
expected = [:posts, :users]
|
46
|
+
resources.must_equal expected.sort_by{|sym| sym.to_s}
|
38
47
|
end
|
39
|
-
|
40
48
|
end
|
41
|
-
|
42
49
|
end
|
43
|
-
|
44
|
-
|
data/test/unit/domain_test.rb
CHANGED
@@ -17,7 +17,7 @@ describe HammerCLIForeman::Domain do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
context "output" do
|
20
|
-
let(:expected_record_count) { cmd.resource.call(:index)
|
20
|
+
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
21
21
|
|
22
22
|
it_should_print_n_records
|
23
23
|
it_should_print_columns ["Id", "Name"]
|
@@ -17,7 +17,7 @@ describe HammerCLIForeman::Environment do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
context "output" do
|
20
|
-
let(:expected_record_count) { cmd.resource.call(:index)
|
20
|
+
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
21
21
|
|
22
22
|
it_should_print_n_records
|
23
23
|
it_should_print_column "Name"
|
@@ -20,7 +20,7 @@ describe HammerCLIForeman::ExternalUsergroup do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
context "output" do
|
23
|
-
let(:expected_record_count) { cmd.resource.call(:index, :usergroup_id => 1)
|
23
|
+
let(:expected_record_count) { count_records(cmd.resource.call(:index, :usergroup_id => 1)) }
|
24
24
|
|
25
25
|
with_params ["--user-group-id=1"] do
|
26
26
|
it_should_print_n_records
|
@@ -24,7 +24,7 @@ class IdResolverTestProxy
|
|
24
24
|
|
25
25
|
method_name = "#{resource.singular_name}_ids"
|
26
26
|
self.class.send(:define_method, method_name) do |options|
|
27
|
-
[1]
|
27
|
+
options["option_#{resource.singular_name}_ids"].nil? ? nil : [1]
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -43,6 +43,10 @@ module CommandTestHelper
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
def count_records(data)
|
47
|
+
HammerCLIForeman.collection_to_common_format(data['results']).count
|
48
|
+
end
|
49
|
+
|
46
50
|
module ClassMethods
|
47
51
|
|
48
52
|
def with_params(params, &block)
|
data/test/unit/host_test.rb
CHANGED
@@ -17,7 +17,7 @@ describe HammerCLIForeman::Host do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
context "output" do
|
20
|
-
let(:expected_record_count) { cmd.resource.call(:index)
|
20
|
+
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
21
21
|
|
22
22
|
it_should_print_n_records
|
23
23
|
it_should_print_columns ["Id", "Name", "Operating System", "Host Group", "IP", "MAC"]
|
@@ -73,7 +73,7 @@ describe HammerCLIForeman::Host do
|
|
73
73
|
|
74
74
|
it "should output status" do
|
75
75
|
cmd.stubs(:context).returns(ctx.update(:adapter => :test))
|
76
|
-
proc { cmd.run(with_params) }.must_output "#Status#Power#\n#
|
76
|
+
proc { cmd.run(with_params) }.must_output "#Status#Power#\n#No reports#running#\n"
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
@@ -160,7 +160,7 @@ describe HammerCLIForeman::Host do
|
|
160
160
|
|
161
161
|
context "output" do
|
162
162
|
with_params ["--id=1"] do
|
163
|
-
let(:expected_record_count) { cmd.resource.call(:index)
|
163
|
+
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
164
164
|
|
165
165
|
it_should_print_n_records
|
166
166
|
it_should_print_column "Id"
|
@@ -202,7 +202,7 @@ describe HammerCLIForeman::Host do
|
|
202
202
|
it_should_accept "name, environment_id, architecture_id, domain_id, puppet_proxy_id, operatingsystem_id and more",
|
203
203
|
["--name=host", "--environment-id=1", "--architecture-id=1", "--domain-id=1", "--puppet-proxy-id=1", "--operatingsystem-id=1",
|
204
204
|
"--ip=1.2.3.4", "--mac=11:22:33:44:55:66", "--medium-id=1", "--partition-table-id=1", "--subnet-id=1",
|
205
|
-
"--
|
205
|
+
"--model-id=1", "--hostgroup-id=1", "--owner-id=1", '--puppet-ca-proxy-id=1', '--puppet-class-ids',
|
206
206
|
"--root-password=pwd", "--ask-root-password=true", "--provision-method=build", "--interface=primary=true,provision=true"]
|
207
207
|
it_should_fail_with "name or id missing",
|
208
208
|
["--environment-id=1", "--architecture-id=1", "--domain-id=1", "--puppet-proxy-id=1", "--operatingsystem-id=1", "--interface=primary=true,provision=true"]
|
@@ -221,7 +221,7 @@ describe HammerCLIForeman::Host do
|
|
221
221
|
|
222
222
|
with_params ["--name=host", "--environment-id=1", "--architecture-id=1", "--domain-id=1", "--puppet-proxy-id=1", "--operatingsystem-id=1",
|
223
223
|
"--ip=1.2.3.4", "--mac=11:22:33:44:55:66", "--medium-id=1", "--partition-table-id=1", "--subnet-id=1",
|
224
|
-
"--
|
224
|
+
"--model-id=1", "--hostgroup-id=1", "--owner-id=1", '--puppet-ca-proxy-id=1', '--puppet-class-ids',
|
225
225
|
"--root-password=pwd", "--ask-root-password=true", "--provision-method=build", "--interface=primary=true,provision=true"] do
|
226
226
|
it_should_call_action_and_test_params(:create) { |par| par["host"]["managed"] == true }
|
227
227
|
it_should_call_action_and_test_params(:create) { |par| par["host"]["build"] == true }
|
@@ -231,8 +231,11 @@ describe HammerCLIForeman::Host do
|
|
231
231
|
it_should_call_action_and_test_params(:create) { |par| par["host"]["interfaces_attributes"]["0"]["provision"] == "true" }
|
232
232
|
end
|
233
233
|
|
234
|
-
with_params ["--name=host", "--hostgroup-id=1", "--interface=primary=true,provision=true", "--parameters=servers=[pool.ntp.org,ntp.time.org]"] do
|
235
|
-
it_should_call_action_and_test_params(:create)
|
234
|
+
with_params ["--name=host", "--hostgroup-id=1", "--interface=primary=true,provision=true", "--parameters=servers=[pool.ntp.org,ntp.time.org],password=secret"] do
|
235
|
+
it_should_call_action_and_test_params(:create) do |par|
|
236
|
+
par["host"]["host_parameters_attributes"][0]["value"] == "[\"pool.ntp.org\", \"ntp.time.org\"]" &&
|
237
|
+
par["host"]["host_parameters_attributes"][1]["value"] == "secret"
|
238
|
+
end
|
236
239
|
end
|
237
240
|
|
238
241
|
it_should_fail_with "primary interface missing", ["--hostgroup-id=example", "--interface=primary=true"]
|
@@ -253,7 +256,7 @@ describe HammerCLIForeman::Host do
|
|
253
256
|
it_should_accept "id and more", ["--id=1", "--new-name=host2", "--environment-id=1", "--architecture-id=1",
|
254
257
|
"--domain-id=1", "--puppet-proxy-id=1", "--operatingsystem-id=1",
|
255
258
|
"--ip=1.2.3.4", "--mac=11:22:33:44:55:66", "--medium-id=1", "--partition-table-id=1", "--subnet-id=1",
|
256
|
-
"--
|
259
|
+
"--model-id=1", "--hostgroup-id=1", "--owner-id=1", '--puppet-ca-proxy-id=1',
|
257
260
|
"--root-password=pwd", "--ask-root-password=true", "--provision-method=build"]
|
258
261
|
# it_should_fail_with "no params", []
|
259
262
|
# it_should_fail_with "name or id missing", ["--new-name=host2"]
|
@@ -263,6 +266,7 @@ describe HammerCLIForeman::Host do
|
|
263
266
|
it_should_call_action_and_test_params(:update) { |par| par["host"].key?("managed") != true }
|
264
267
|
it_should_call_action_and_test_params(:update) { |par| par["host"].key?("build") != true }
|
265
268
|
it_should_call_action_and_test_params(:update) { |par| par["host"].key?("enabled") != true }
|
269
|
+
it_should_call_action_and_test_params(:update) { |par| par["host"].key?("overwrite") != true }
|
266
270
|
end
|
267
271
|
|
268
272
|
with_params ["--id=1", "--enabled=true"] do
|
@@ -273,6 +277,10 @@ describe HammerCLIForeman::Host do
|
|
273
277
|
it_should_call_action_and_test_params(:update) { |par| par["host"]["enabled"] == false }
|
274
278
|
end
|
275
279
|
|
280
|
+
with_params ["--id=1", "--overwrite=true"] do
|
281
|
+
it_should_call_action_and_test_params(:update) { |par| par["host"]["overwrite"] == true }
|
282
|
+
end
|
283
|
+
|
276
284
|
with_params ["--id=1","--provision-method=build"] do
|
277
285
|
it_should_call_action_and_test_params(:update) { |par| par["host"]["provision_method"] == "build" }
|
278
286
|
end
|
data/test/unit/hostgroup_test.rb
CHANGED
@@ -17,7 +17,7 @@ describe HammerCLIForeman::Hostgroup do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
context "output" do
|
20
|
-
let(:expected_record_count) { cmd.resource.call(:index)
|
20
|
+
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
21
21
|
|
22
22
|
it_should_print_n_records
|
23
23
|
it_should_print_columns ["Id", "Name", "Title", "Operating System"]
|
@@ -4,7 +4,11 @@ require File.join(File.dirname(__FILE__), 'helpers/fake_searchables')
|
|
4
4
|
|
5
5
|
describe HammerCLIForeman::IdResolver do
|
6
6
|
|
7
|
-
let(:api)
|
7
|
+
let(:api) do ApipieBindings::API.new({
|
8
|
+
:apidoc_cache_dir => 'test/unit/data',
|
9
|
+
:apidoc_cache_name => 'test_api',
|
10
|
+
:dry_run => true})
|
11
|
+
end
|
8
12
|
let(:searchables) { FakeSearchables.new(['name','label']) }
|
9
13
|
let(:resolver) { HammerCLIForeman::IdResolver.new(api, searchables) }
|
10
14
|
|
@@ -66,7 +70,7 @@ describe HammerCLIForeman::IdResolver do
|
|
66
70
|
end
|
67
71
|
|
68
72
|
describe "when no search options are found" do
|
69
|
-
let(:resolver_run) { proc { resolver.
|
73
|
+
let(:resolver_run) { proc { resolver.comment_id({"option_unknown" => "value"}) } }
|
70
74
|
|
71
75
|
it "raises exception" do
|
72
76
|
err = resolver_run.must_raise HammerCLIForeman::MissingSeachOptions
|
@@ -74,49 +78,49 @@ describe HammerCLIForeman::IdResolver do
|
|
74
78
|
|
75
79
|
it "builds correct error message" do
|
76
80
|
err = resolver_run.must_raise HammerCLIForeman::MissingSeachOptions
|
77
|
-
err.message.must_equal "Missing options to search
|
81
|
+
err.message.must_equal "Missing options to search comment"
|
78
82
|
end
|
79
83
|
end
|
80
84
|
|
81
85
|
describe "searching independent resource" do
|
82
|
-
let(:resolver_run) { proc { resolver.
|
86
|
+
let(:resolver_run) { proc { resolver.user_id({"option_name" => "John Doe"}) } }
|
83
87
|
|
84
88
|
it "raises exception when no resource is found" do
|
85
|
-
ResourceMocks.mock_action_call(:
|
89
|
+
ResourceMocks.mock_action_call(:users, :index, [])
|
86
90
|
|
87
91
|
err = resolver_run.must_raise HammerCLIForeman::ResolverError
|
88
|
-
err.message.must_equal "
|
92
|
+
err.message.must_equal "user not found"
|
89
93
|
end
|
90
94
|
|
91
95
|
it "raises exception when multiple resources are found" do
|
92
|
-
ResourceMocks.mock_action_call(:
|
93
|
-
{"id" => 11, "name" => "
|
94
|
-
{"id" => 22, "name" => "
|
96
|
+
ResourceMocks.mock_action_call(:users, :index, [
|
97
|
+
{"id" => 11, "name" => "user11"},
|
98
|
+
{"id" => 22, "name" => "user22"}
|
95
99
|
])
|
96
100
|
|
97
101
|
err = resolver_run.must_raise HammerCLIForeman::ResolverError
|
98
|
-
err.message.must_equal "
|
102
|
+
err.message.must_equal "found more than one user"
|
99
103
|
end
|
100
104
|
|
101
105
|
it "calls index action with appropriate search params" do
|
102
106
|
ApipieBindings::API.any_instance.expects(:call).with() do |resource, action, params, headers, opts|
|
103
|
-
( resource == :
|
107
|
+
( resource == :users &&
|
104
108
|
action == :index &&
|
105
|
-
params[:search] == "name = \"
|
106
|
-
end.returns({"id" =>
|
109
|
+
params[:search] == "name = \"John Doe\"")
|
110
|
+
end.returns({"id" => 1, "name" => "John Doe"})
|
107
111
|
|
108
112
|
resolver_run.call
|
109
113
|
end
|
110
114
|
|
111
115
|
it "uses option id when it's available" do
|
112
|
-
ResourceMocks.mock_action_call(:
|
116
|
+
ResourceMocks.mock_action_call(:users, :index, [])
|
113
117
|
|
114
|
-
resolver.
|
118
|
+
resolver.user_id({"option_id" => 83, "option_name" => "John Doe"}).must_equal 83
|
115
119
|
end
|
116
120
|
|
117
121
|
it "returns id of the resource" do
|
118
|
-
ResourceMocks.mock_action_call(:
|
119
|
-
{"id" => 11, "name" => "
|
122
|
+
ResourceMocks.mock_action_call(:users, :index, [
|
123
|
+
{"id" => 11, "name" => "John Doe"}
|
120
124
|
])
|
121
125
|
|
122
126
|
resolver_run.call.must_equal 11
|
@@ -125,51 +129,50 @@ describe HammerCLIForeman::IdResolver do
|
|
125
129
|
end
|
126
130
|
|
127
131
|
describe "searching dependent resources" do
|
128
|
-
let(:resolver_run) { proc { resolver.
|
132
|
+
let(:resolver_run) { proc { resolver.post_id({"option_name" => "Post 11", "option_user_name" => "User 22"}) } }
|
129
133
|
|
130
134
|
it "raises exception when no resource is found" do
|
131
|
-
ResourceMocks.mock_action_call(:
|
132
|
-
ResourceMocks.mock_action_call(:
|
135
|
+
ResourceMocks.mock_action_call(:posts, :index, [])
|
136
|
+
ResourceMocks.mock_action_call(:users, :index, [])
|
133
137
|
|
134
138
|
err = resolver_run.must_raise HammerCLIForeman::ResolverError
|
135
|
-
err.message.must_equal "
|
139
|
+
err.message.must_equal "user not found"
|
136
140
|
end
|
137
141
|
|
138
142
|
it "raises exception when multiple resources are found" do
|
139
|
-
ResourceMocks.mock_action_call(:
|
140
|
-
ResourceMocks.mock_action_call(:
|
141
|
-
{"id" => 11, "name" => "
|
142
|
-
{"id" => 22, "name" => "
|
143
|
+
ResourceMocks.mock_action_call(:posts, :index, [])
|
144
|
+
ResourceMocks.mock_action_call(:users, :index, [
|
145
|
+
{"id" => 11, "name" => "user1"},
|
146
|
+
{"id" => 22, "name" => "user2"}
|
143
147
|
])
|
144
148
|
|
145
149
|
err = resolver_run.must_raise HammerCLIForeman::ResolverError
|
146
|
-
err.message.must_equal "
|
150
|
+
err.message.must_equal "found more than one user"
|
147
151
|
end
|
148
152
|
|
149
153
|
it "calls index action with appropriate search params" do
|
150
154
|
ApipieBindings::API.any_instance.expects(:call).with() do |resource, action, params, headers, opts|
|
151
|
-
( resource == :
|
155
|
+
( resource == :users &&
|
152
156
|
action == :index &&
|
153
|
-
params[:search] == "name = \"
|
154
|
-
end.returns({"id" =>
|
157
|
+
params[:search] == "name = \"User 22\"")
|
158
|
+
end.returns({"id" => 22, "name" => "User 22"})
|
155
159
|
|
156
160
|
ApipieBindings::API.any_instance.expects(:call).with() do |resource, action, params, headers, opts|
|
157
|
-
( resource == :
|
161
|
+
( resource == :posts &&
|
158
162
|
action == :index &&
|
159
|
-
params[:search] == "name = \"
|
160
|
-
end.returns({"id" => 11, "name" => "
|
163
|
+
params[:search] == "name = \"Post 11\"")
|
164
|
+
end.returns({"id" => 11, "name" => "Post 11"})
|
161
165
|
|
162
166
|
resolver_run.call
|
163
167
|
end
|
164
168
|
|
165
169
|
it "returns id of the resource" do
|
166
|
-
ResourceMocks.mock_action_call(:
|
167
|
-
{"id" => 11, "name" => "
|
170
|
+
ResourceMocks.mock_action_call(:posts, :index, [
|
171
|
+
{"id" => 11, "name" => "Post 11"}
|
168
172
|
])
|
169
|
-
ResourceMocks.mock_action_call(:
|
170
|
-
{"id" => 22, "name" => "
|
173
|
+
ResourceMocks.mock_action_call(:users, :index, [
|
174
|
+
{"id" => 22, "name" => "User 22"}
|
171
175
|
])
|
172
|
-
|
173
176
|
resolver_run.call.must_equal 11
|
174
177
|
end
|
175
178
|
end
|
data/test/unit/image_test.rb
CHANGED
@@ -20,7 +20,7 @@ describe HammerCLIForeman::Image do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
context "output" do
|
23
|
-
let(:expected_record_count) { cmd.resource.call(:index, :compute_resource_id=>1)
|
23
|
+
let(:expected_record_count) { count_records(cmd.resource.call(:index, :compute_resource_id=>1)) }
|
24
24
|
|
25
25
|
with_params ["--compute-resource-id=1"] do
|
26
26
|
it_should_print_n_records
|
@@ -130,5 +130,3 @@ describe HammerCLIForeman::Image do
|
|
130
130
|
end
|
131
131
|
|
132
132
|
end
|
133
|
-
|
134
|
-
|
data/test/unit/location_test.rb
CHANGED
@@ -22,7 +22,7 @@ describe HammerCLIForeman::Location do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
context "output" do
|
25
|
-
let(:expected_record_count) { cmd.resource.call(:index)
|
25
|
+
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
26
26
|
|
27
27
|
it_should_print_n_records
|
28
28
|
it_should_print_column "Name"
|
data/test/unit/media_test.rb
CHANGED
@@ -17,7 +17,7 @@ describe HammerCLIForeman::Medium do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
context "output" do
|
20
|
-
let(:expected_record_count) { cmd.resource.call(:index)
|
20
|
+
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
21
21
|
|
22
22
|
it_should_print_n_records
|
23
23
|
it_should_print_column "Name"
|
@@ -63,7 +63,7 @@ describe HammerCLIForeman::Medium do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
with_params ["--name=medium_x", "--path=http://some.path/", "--operatingsystem-ids=1,2"] do
|
66
|
-
it_should_call_action :create, {'medium' => {'name' => 'medium_x', 'path' => 'http://some.path/', 'operatingsystem_ids' => [1]
|
66
|
+
it_should_call_action :create, {'medium' => {'name' => 'medium_x', 'path' => 'http://some.path/', 'operatingsystem_ids' => [1]}}
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -92,7 +92,7 @@ describe HammerCLIForeman::Medium do
|
|
92
92
|
end
|
93
93
|
|
94
94
|
with_params ["--id=1", "--new-name=medium_x", "--path=http://some.path/", "--operatingsystem-ids=1,2"] do
|
95
|
-
it_should_call_action :update, {'id' => '1', 'name' => 'medium_x', 'medium' => {'name' => 'medium_x', 'path' => 'http://some.path/', 'operatingsystem_ids' => [1]
|
95
|
+
it_should_call_action :update, {'id' => '1', 'name' => 'medium_x', 'medium' => {'name' => 'medium_x', 'path' => 'http://some.path/', 'operatingsystem_ids' => [1]}}
|
96
96
|
end
|
97
97
|
|
98
98
|
end
|