inspec 4.18.51 → 4.18.85
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/inspec.gemspec +15 -37
- data/lib/resource_support/aws/aws_resource_mixin.rb +1 -1
- metadata +22 -709
- data/Gemfile +0 -61
- data/LICENSE +0 -14
- data/README.md +0 -474
- data/etc/deprecations.json +0 -125
- data/etc/plugin_filters.json +0 -45
- data/lib/bundles/README.md +0 -3
- data/lib/bundles/inspec-compliance/api.rb +0 -7
- data/lib/bundles/inspec-compliance/configuration.rb +0 -7
- data/lib/bundles/inspec-compliance/http.rb +0 -7
- data/lib/bundles/inspec-compliance/support.rb +0 -7
- data/lib/bundles/inspec-compliance/target.rb +0 -7
- data/lib/bundles/inspec-supermarket.rb +0 -9
- data/lib/bundles/inspec-supermarket/README.md +0 -45
- data/lib/bundles/inspec-supermarket/api.rb +0 -87
- data/lib/bundles/inspec-supermarket/cli.rb +0 -71
- data/lib/bundles/inspec-supermarket/target.rb +0 -31
- data/lib/inspec.rb +0 -30
- data/lib/inspec/archive/tar.rb +0 -25
- data/lib/inspec/archive/zip.rb +0 -15
- data/lib/inspec/backend.rb +0 -101
- data/lib/inspec/base_cli.rb +0 -318
- data/lib/inspec/cached_fetcher.rb +0 -65
- data/lib/inspec/cli.rb +0 -469
- data/lib/inspec/completions/bash.sh.erb +0 -45
- data/lib/inspec/completions/fish.sh.erb +0 -34
- data/lib/inspec/completions/zsh.sh.erb +0 -61
- data/lib/inspec/config.rb +0 -511
- data/lib/inspec/control_eval_context.rb +0 -248
- data/lib/inspec/dependencies/cache.rb +0 -74
- data/lib/inspec/dependencies/dependency_set.rb +0 -93
- data/lib/inspec/dependencies/lockfile.rb +0 -115
- data/lib/inspec/dependencies/requirement.rb +0 -135
- data/lib/inspec/dependencies/resolver.rb +0 -86
- data/lib/inspec/describe_base.rb +0 -53
- data/lib/inspec/dist.rb +0 -20
- data/lib/inspec/dsl.rb +0 -115
- data/lib/inspec/dsl_shared.rb +0 -32
- data/lib/inspec/env_printer.rb +0 -156
- data/lib/inspec/errors.rb +0 -18
- data/lib/inspec/exceptions.rb +0 -11
- data/lib/inspec/expect.rb +0 -42
- data/lib/inspec/fetcher.rb +0 -48
- data/lib/inspec/fetcher/git.rb +0 -211
- data/lib/inspec/fetcher/local.rb +0 -116
- data/lib/inspec/fetcher/mock.rb +0 -34
- data/lib/inspec/fetcher/url.rb +0 -281
- data/lib/inspec/file_provider.rb +0 -318
- data/lib/inspec/formatters.rb +0 -3
- data/lib/inspec/formatters/base.rb +0 -269
- data/lib/inspec/formatters/json_rspec.rb +0 -20
- data/lib/inspec/formatters/show_progress.rb +0 -12
- data/lib/inspec/globals.rb +0 -9
- data/lib/inspec/impact.rb +0 -36
- data/lib/inspec/input.rb +0 -421
- data/lib/inspec/input_dsl_helpers.rb +0 -26
- data/lib/inspec/input_registry.rb +0 -315
- data/lib/inspec/library_eval_context.rb +0 -55
- data/lib/inspec/log.rb +0 -7
- data/lib/inspec/metadata.rb +0 -253
- data/lib/inspec/method_source.rb +0 -20
- data/lib/inspec/objects.rb +0 -14
- data/lib/inspec/objects/control.rb +0 -85
- data/lib/inspec/objects/describe.rb +0 -106
- data/lib/inspec/objects/each_loop.rb +0 -41
- data/lib/inspec/objects/input.rb +0 -49
- data/lib/inspec/objects/list.rb +0 -15
- data/lib/inspec/objects/or_test.rb +0 -45
- data/lib/inspec/objects/ruby_helper.rb +0 -13
- data/lib/inspec/objects/tag.rb +0 -32
- data/lib/inspec/objects/test.rb +0 -94
- data/lib/inspec/objects/value.rb +0 -32
- data/lib/inspec/plugin/v1.rb +0 -2
- data/lib/inspec/plugin/v1/plugin_types/cli.rb +0 -22
- data/lib/inspec/plugin/v1/plugin_types/fetcher.rb +0 -83
- data/lib/inspec/plugin/v1/plugin_types/resource.rb +0 -176
- data/lib/inspec/plugin/v1/plugin_types/secret.rb +0 -11
- data/lib/inspec/plugin/v1/plugin_types/source_reader.rb +0 -36
- data/lib/inspec/plugin/v1/plugins.rb +0 -59
- data/lib/inspec/plugin/v1/registry.rb +0 -90
- data/lib/inspec/plugin/v2.rb +0 -46
- data/lib/inspec/plugin/v2/activator.rb +0 -40
- data/lib/inspec/plugin/v2/config_file.rb +0 -151
- data/lib/inspec/plugin/v2/filter.rb +0 -96
- data/lib/inspec/plugin/v2/installer.rb +0 -512
- data/lib/inspec/plugin/v2/loader.rb +0 -321
- data/lib/inspec/plugin/v2/plugin_base.rb +0 -112
- data/lib/inspec/plugin/v2/plugin_types/cli.rb +0 -49
- data/lib/inspec/plugin/v2/plugin_types/dsl.rb +0 -11
- data/lib/inspec/plugin/v2/plugin_types/input.rb +0 -34
- data/lib/inspec/plugin/v2/plugin_types/mock.rb +0 -12
- data/lib/inspec/plugin/v2/registry.rb +0 -98
- data/lib/inspec/plugin/v2/status.rb +0 -29
- data/lib/inspec/profile.rb +0 -658
- data/lib/inspec/profile_context.rb +0 -203
- data/lib/inspec/profile_vendor.rb +0 -84
- data/lib/inspec/reporters.rb +0 -73
- data/lib/inspec/reporters/automate.rb +0 -78
- data/lib/inspec/reporters/base.rb +0 -25
- data/lib/inspec/reporters/cli.rb +0 -370
- data/lib/inspec/reporters/json.rb +0 -113
- data/lib/inspec/reporters/json_automate.rb +0 -80
- data/lib/inspec/reporters/json_min.rb +0 -48
- data/lib/inspec/reporters/junit.rb +0 -77
- data/lib/inspec/reporters/yaml.rb +0 -20
- data/lib/inspec/require_loader.rb +0 -29
- data/lib/inspec/resource.rb +0 -114
- data/lib/inspec/resources.rb +0 -130
- data/lib/inspec/resources/aide_conf.rb +0 -153
- data/lib/inspec/resources/apache.rb +0 -47
- data/lib/inspec/resources/apache_conf.rb +0 -156
- data/lib/inspec/resources/apt.rb +0 -151
- data/lib/inspec/resources/audit_policy.rb +0 -64
- data/lib/inspec/resources/auditd.rb +0 -251
- data/lib/inspec/resources/auditd_conf.rb +0 -45
- data/lib/inspec/resources/bash.rb +0 -33
- data/lib/inspec/resources/bond.rb +0 -70
- data/lib/inspec/resources/bridge.rb +0 -125
- data/lib/inspec/resources/bsd_service.rb +0 -2
- data/lib/inspec/resources/chocolatey_package.rb +0 -82
- data/lib/inspec/resources/command.rb +0 -91
- data/lib/inspec/resources/cpan.rb +0 -58
- data/lib/inspec/resources/cran.rb +0 -64
- data/lib/inspec/resources/crontab.rb +0 -173
- data/lib/inspec/resources/csv.rb +0 -56
- data/lib/inspec/resources/dh_params.rb +0 -83
- data/lib/inspec/resources/directory.rb +0 -23
- data/lib/inspec/resources/docker.rb +0 -274
- data/lib/inspec/resources/docker_container.rb +0 -91
- data/lib/inspec/resources/docker_image.rb +0 -84
- data/lib/inspec/resources/docker_object.rb +0 -52
- data/lib/inspec/resources/docker_plugin.rb +0 -64
- data/lib/inspec/resources/docker_service.rb +0 -91
- data/lib/inspec/resources/elasticsearch.rb +0 -165
- data/lib/inspec/resources/etc_fstab.rb +0 -96
- data/lib/inspec/resources/etc_group.rb +0 -157
- data/lib/inspec/resources/etc_hosts.rb +0 -68
- data/lib/inspec/resources/etc_hosts_allow.rb +0 -2
- data/lib/inspec/resources/etc_hosts_allow_deny.rb +0 -114
- data/lib/inspec/resources/etc_hosts_deny.rb +0 -2
- data/lib/inspec/resources/file.rb +0 -339
- data/lib/inspec/resources/filesystem.rb +0 -139
- data/lib/inspec/resources/firewalld.rb +0 -148
- data/lib/inspec/resources/gem.rb +0 -80
- data/lib/inspec/resources/group.rb +0 -2
- data/lib/inspec/resources/groups.rb +0 -241
- data/lib/inspec/resources/grub_conf.rb +0 -230
- data/lib/inspec/resources/host.rb +0 -310
- data/lib/inspec/resources/http.rb +0 -275
- data/lib/inspec/resources/iis_app.rb +0 -101
- data/lib/inspec/resources/iis_app_pool.rb +0 -127
- data/lib/inspec/resources/iis_site.rb +0 -148
- data/lib/inspec/resources/iis_website.rb +0 -2
- data/lib/inspec/resources/inetd_conf.rb +0 -53
- data/lib/inspec/resources/ini.rb +0 -28
- data/lib/inspec/resources/interface.rb +0 -204
- data/lib/inspec/resources/ip6tables.rb +0 -79
- data/lib/inspec/resources/iptables.rb +0 -80
- data/lib/inspec/resources/json.rb +0 -116
- data/lib/inspec/resources/kernel_module.rb +0 -106
- data/lib/inspec/resources/kernel_parameter.rb +0 -54
- data/lib/inspec/resources/key_rsa.rb +0 -66
- data/lib/inspec/resources/ksh.rb +0 -33
- data/lib/inspec/resources/launchd_service.rb +0 -2
- data/lib/inspec/resources/limits_conf.rb +0 -45
- data/lib/inspec/resources/linux_kernel_parameter.rb +0 -2
- data/lib/inspec/resources/login_defs.rb +0 -56
- data/lib/inspec/resources/mount.rb +0 -88
- data/lib/inspec/resources/mssql_session.rb +0 -117
- data/lib/inspec/resources/mysql.rb +0 -81
- data/lib/inspec/resources/mysql_conf.rb +0 -128
- data/lib/inspec/resources/mysql_session.rb +0 -88
- data/lib/inspec/resources/nginx.rb +0 -96
- data/lib/inspec/resources/nginx_conf.rb +0 -232
- data/lib/inspec/resources/noop.rb +0 -9
- data/lib/inspec/resources/npm.rb +0 -68
- data/lib/inspec/resources/ntp_conf.rb +0 -51
- data/lib/inspec/resources/oneget.rb +0 -71
- data/lib/inspec/resources/oracledb_session.rb +0 -149
- data/lib/inspec/resources/os.rb +0 -34
- data/lib/inspec/resources/os_env.rb +0 -86
- data/lib/inspec/resources/package.rb +0 -391
- data/lib/inspec/resources/packages.rb +0 -111
- data/lib/inspec/resources/parse_config.rb +0 -112
- data/lib/inspec/resources/parse_config_file.rb +0 -2
- data/lib/inspec/resources/passwd.rb +0 -73
- data/lib/inspec/resources/pip.rb +0 -132
- data/lib/inspec/resources/platform.rb +0 -112
- data/lib/inspec/resources/port.rb +0 -791
- data/lib/inspec/resources/postfix_conf.rb +0 -35
- data/lib/inspec/resources/postgres.rb +0 -152
- data/lib/inspec/resources/postgres_conf.rb +0 -116
- data/lib/inspec/resources/postgres_hba_conf.rb +0 -86
- data/lib/inspec/resources/postgres_ident_conf.rb +0 -75
- data/lib/inspec/resources/postgres_session.rb +0 -70
- data/lib/inspec/resources/powershell.rb +0 -67
- data/lib/inspec/resources/ppa.rb +0 -2
- data/lib/inspec/resources/processes.rb +0 -219
- data/lib/inspec/resources/rabbitmq_conf.rb +0 -2
- data/lib/inspec/resources/rabbitmq_config.rb +0 -52
- data/lib/inspec/resources/registry_key.rb +0 -296
- data/lib/inspec/resources/runit_service.rb +0 -2
- data/lib/inspec/resources/script.rb +0 -1
- data/lib/inspec/resources/security_identifier.rb +0 -91
- data/lib/inspec/resources/security_policy.rb +0 -182
- data/lib/inspec/resources/service.rb +0 -820
- data/lib/inspec/resources/shadow.rb +0 -150
- data/lib/inspec/resources/ssh_config.rb +0 -98
- data/lib/inspec/resources/sshd_config.rb +0 -2
- data/lib/inspec/resources/ssl.rb +0 -99
- data/lib/inspec/resources/sys_info.rb +0 -119
- data/lib/inspec/resources/systemd_service.rb +0 -2
- data/lib/inspec/resources/sysv_service.rb +0 -2
- data/lib/inspec/resources/toml.rb +0 -30
- data/lib/inspec/resources/upstart_service.rb +0 -2
- data/lib/inspec/resources/user.rb +0 -1
- data/lib/inspec/resources/users.rb +0 -742
- data/lib/inspec/resources/vbscript.rb +0 -67
- data/lib/inspec/resources/virtualization.rb +0 -255
- data/lib/inspec/resources/windows_feature.rb +0 -126
- data/lib/inspec/resources/windows_hotfix.rb +0 -37
- data/lib/inspec/resources/windows_registry_key.rb +0 -2
- data/lib/inspec/resources/windows_task.rb +0 -112
- data/lib/inspec/resources/wmi.rb +0 -109
- data/lib/inspec/resources/x509_certificate.rb +0 -143
- data/lib/inspec/resources/xinetd_conf.rb +0 -103
- data/lib/inspec/resources/xml.rb +0 -48
- data/lib/inspec/resources/yaml.rb +0 -42
- data/lib/inspec/resources/yum.rb +0 -162
- data/lib/inspec/resources/zfs_dataset.rb +0 -62
- data/lib/inspec/resources/zfs_pool.rb +0 -50
- data/lib/inspec/rspec_extensions.rb +0 -116
- data/lib/inspec/rule.rb +0 -389
- data/lib/inspec/runner.rb +0 -333
- data/lib/inspec/runner_mock.rb +0 -37
- data/lib/inspec/runner_rspec.rb +0 -184
- data/lib/inspec/runtime_profile.rb +0 -23
- data/lib/inspec/schema.rb +0 -245
- data/lib/inspec/secrets.rb +0 -15
- data/lib/inspec/secrets/yaml.rb +0 -29
- data/lib/inspec/shell.rb +0 -211
- data/lib/inspec/shell_detector.rb +0 -89
- data/lib/inspec/source_reader.rb +0 -26
- data/lib/inspec/ui.rb +0 -213
- data/lib/inspec/ui_table_helper.rb +0 -12
- data/lib/inspec/utils/command_wrapper.rb +0 -23
- data/lib/inspec/utils/convert.rb +0 -8
- data/lib/inspec/utils/database_helpers.rb +0 -75
- data/lib/inspec/utils/deprecation.rb +0 -6
- data/lib/inspec/utils/deprecation/config_file.rb +0 -109
- data/lib/inspec/utils/deprecation/deprecator.rb +0 -118
- data/lib/inspec/utils/deprecation/errors.rb +0 -14
- data/lib/inspec/utils/deprecation/global_method.rb +0 -9
- data/lib/inspec/utils/enumerable_delegation.rb +0 -7
- data/lib/inspec/utils/erlang_parser.rb +0 -190
- data/lib/inspec/utils/file_reader.rb +0 -24
- data/lib/inspec/utils/filter.rb +0 -461
- data/lib/inspec/utils/filter_array.rb +0 -25
- data/lib/inspec/utils/find_files.rb +0 -44
- data/lib/inspec/utils/hash.rb +0 -37
- data/lib/inspec/utils/json_log.rb +0 -15
- data/lib/inspec/utils/modulator.rb +0 -9
- data/lib/inspec/utils/nginx_parser.rb +0 -101
- data/lib/inspec/utils/object_traversal.rb +0 -47
- data/lib/inspec/utils/parser.rb +0 -277
- data/lib/inspec/utils/pkey_reader.rb +0 -17
- data/lib/inspec/utils/simpleconfig.rb +0 -121
- data/lib/inspec/utils/spdx.rb +0 -10
- data/lib/inspec/utils/spdx.txt +0 -383
- data/lib/inspec/utils/telemetry.rb +0 -3
- data/lib/inspec/utils/telemetry/collector.rb +0 -81
- data/lib/inspec/utils/telemetry/data_series.rb +0 -44
- data/lib/inspec/utils/telemetry/global_methods.rb +0 -22
- data/lib/inspec/version.rb +0 -3
- data/lib/matchers/matchers.rb +0 -341
- data/lib/plugins/README.md +0 -16
- data/lib/plugins/inspec-artifact/lib/inspec-artifact.rb +0 -12
- data/lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb +0 -170
- data/lib/plugins/inspec-artifact/lib/inspec-artifact/cli.rb +0 -116
- data/lib/plugins/inspec-artifact/test/functional/inspec_artifact_test.rb +0 -50
- data/lib/plugins/inspec-compliance/README.md +0 -207
- data/lib/plugins/inspec-compliance/lib/inspec-compliance.rb +0 -12
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb +0 -362
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/api/login.rb +0 -198
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb +0 -269
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/configuration.rb +0 -103
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/http.rb +0 -117
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/images/cc-token.png +0 -0
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb +0 -34
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/target.rb +0 -146
- data/lib/plugins/inspec-compliance/test/functional/inspec_compliance_test.rb +0 -53
- data/lib/plugins/inspec-compliance/test/integration/default/cli.rb +0 -91
- data/lib/plugins/inspec-compliance/test/unit/api/login_test.rb +0 -190
- data/lib/plugins/inspec-compliance/test/unit/api_test.rb +0 -386
- data/lib/plugins/inspec-compliance/test/unit/target_test.rb +0 -155
- data/lib/plugins/inspec-habitat/Berksfile +0 -5
- data/lib/plugins/inspec-habitat/README.md +0 -150
- data/lib/plugins/inspec-habitat/kitchen.yml +0 -28
- data/lib/plugins/inspec-habitat/lib/inspec-habitat.rb +0 -11
- data/lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb +0 -41
- data/lib/plugins/inspec-habitat/lib/inspec-habitat/profile.rb +0 -265
- data/lib/plugins/inspec-habitat/templates/habitat/plan.sh.erb +0 -6
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/Berksfile +0 -2
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/README.md +0 -3
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/files/hab_setup.exp +0 -28
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/metadata.rb +0 -9
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/recipes/default.rb +0 -61
- data/lib/plugins/inspec-habitat/test/functional/inspec_habitat_test.rb +0 -34
- data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/README.md +0 -3
- data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb +0 -40
- data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/inspec.yml +0 -10
- data/lib/plugins/inspec-habitat/test/support/example_profile/README.md +0 -3
- data/lib/plugins/inspec-habitat/test/support/example_profile/controls/example.rb +0 -7
- data/lib/plugins/inspec-habitat/test/support/example_profile/inspec.yml +0 -10
- data/lib/plugins/inspec-habitat/test/unit/profile_test.rb +0 -242
- data/lib/plugins/inspec-init/README.md +0 -31
- data/lib/plugins/inspec-init/lib/inspec-init.rb +0 -12
- data/lib/plugins/inspec-init/lib/inspec-init/cli.rb +0 -15
- data/lib/plugins/inspec-init/lib/inspec-init/cli_plugin.rb +0 -243
- data/lib/plugins/inspec-init/lib/inspec-init/cli_profile.rb +0 -47
- data/lib/plugins/inspec-init/lib/inspec-init/renderer.rb +0 -97
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Gemfile +0 -11
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/LICENSE +0 -2
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/README.md +0 -28
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Rakefile +0 -40
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template.rb +0 -14
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/cli_command.rb +0 -62
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/plugin.rb +0 -53
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/version.rb +0 -8
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/fixtures/README.md +0 -24
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/functional/README.md +0 -12
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/functional/inspec_plugin_template_test.rb +0 -110
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/helper.rb +0 -24
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/README.md +0 -17
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/cli_args_test.rb +0 -67
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/plugin_def_test.rb +0 -51
- data/lib/plugins/inspec-init/templates/profiles/aws/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/templates/profiles/azure/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/templates/profiles/gcp/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/templates/profiles/os/README.md +0 -3
- data/lib/plugins/inspec-init/templates/profiles/os/controls/example.rb +0 -18
- data/lib/plugins/inspec-init/templates/profiles/os/inspec.yml +0 -10
- data/lib/plugins/inspec-init/templates/profiles/os/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/test/functional/inspec_init_plugin_test.rb +0 -184
- data/lib/plugins/inspec-init/test/functional/inspec_init_profile_test.rb +0 -121
- data/lib/plugins/inspec-plugin-manager-cli/README.md +0 -6
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli.rb +0 -17
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb +0 -518
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/plugin.rb +0 -12
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/config_dirs/empty/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette.rb +0 -2
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-wrong-structure/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name.rb +0 -1
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/help_test.rb +0 -23
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/helper.rb +0 -62
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/install_test.rb +0 -368
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/list_test.rb +0 -101
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/search_test.rb +0 -129
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/uninstall_test.rb +0 -63
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/update_test.rb +0 -84
- data/lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb +0 -77
- data/lib/plugins/inspec-plugin-manager-cli/test/unit/plugin_def_test.rb +0 -39
- data/lib/plugins/shared/core_plugin_test_helper.rb +0 -153
- data/lib/plugins/things-for-train-integration.rb +0 -14
- data/lib/source_readers/flat.rb +0 -36
- data/lib/source_readers/inspec.rb +0 -66
@@ -1,101 +0,0 @@
|
|
1
|
-
require_relative "helper"
|
2
|
-
|
3
|
-
class PluginManagerCliList < Minitest::Test
|
4
|
-
include CorePluginFunctionalHelper
|
5
|
-
include PluginManagerHelpers
|
6
|
-
|
7
|
-
# Listing all plugins is now default behavior
|
8
|
-
LIST_CASES = [
|
9
|
-
{ arg: "-c", name: "inspec-plugin-manager-cli", type: "core" },
|
10
|
-
{ arg: "-c", name: "inspec-supermarket", type: "core" },
|
11
|
-
{ arg: "-s", name: "train-aws", type: "gem (system)" },
|
12
|
-
].freeze
|
13
|
-
|
14
|
-
def test_list_all_when_no_user_plugins_installed
|
15
|
-
result = run_inspec_process_with_this_plugin("plugin list --all")
|
16
|
-
skip_windows!
|
17
|
-
assert_empty result.stderr
|
18
|
-
|
19
|
-
plugins_seen = parse_plugin_list_lines(result.stdout)
|
20
|
-
|
21
|
-
# Look for a specific plugin of each type - core, bundle, and system
|
22
|
-
LIST_CASES.each do |test_case|
|
23
|
-
plugin_line = plugins_seen.detect { |plugin| plugin[:name] == test_case[:name] }
|
24
|
-
refute_nil plugin_line, "#{test_case[:name]} should be detected in plugin list --all output"
|
25
|
-
assert_equal test_case[:type], plugin_line[:type], "#{test_case[:name]} should be detected as a '#{test_case[:type]}' type in list --all "
|
26
|
-
end
|
27
|
-
assert_exit_code 0, result
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_list_selective_when_no_user_plugins_installed
|
31
|
-
LIST_CASES.each do |test_case|
|
32
|
-
result = run_inspec_process_with_this_plugin("plugin list #{test_case[:arg]}")
|
33
|
-
skip_windows!
|
34
|
-
|
35
|
-
assert_empty result.stderr
|
36
|
-
plugins_seen = parse_plugin_list_lines(result.stdout)
|
37
|
-
plugin_line = plugins_seen.detect { |plugin| plugin[:name] == test_case[:name] }
|
38
|
-
refute_nil plugin_line, "#{test_case[:name]} should be detected in plugin list #{test_case[:arg]} output"
|
39
|
-
assert_equal plugin_line[:type], test_case[:type], "#{test_case[:name]} should be detected as a '#{test_case[:type]}' type in list #{test_case[:arg]} "
|
40
|
-
assert_exit_code 0, result
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_list_when_gem_and_path_plugins_installed
|
45
|
-
pre_block = Proc.new do |plugin_statefile_data, tmp_dir|
|
46
|
-
plugin_statefile_data.clear # Signal not to write a file, we'll provide one.
|
47
|
-
copy_in_core_config_dir("test-fixture-1-float", tmp_dir)
|
48
|
-
end
|
49
|
-
|
50
|
-
result = run_inspec_process_with_this_plugin("plugin list --user ", pre_run: pre_block)
|
51
|
-
skip_windows!
|
52
|
-
|
53
|
-
assert_empty result.stderr
|
54
|
-
plugins_seen = parse_plugin_list_lines(result.stdout)
|
55
|
-
assert_equal 2, plugins_seen.count
|
56
|
-
# Plugin Name Version Via ApiVer
|
57
|
-
# ---------------------------------------------------------
|
58
|
-
# inspec-meaning-of-life src path 2
|
59
|
-
# inspec-test-fixture 0.1.0 gem (user) 2
|
60
|
-
# ---------------------------------------------------------
|
61
|
-
# 2 plugin(s) total
|
62
|
-
meaning = plugins_seen.detect { |p| p[:name] == "inspec-meaning-of-life" }
|
63
|
-
refute_nil meaning
|
64
|
-
assert_equal "path", meaning[:type]
|
65
|
-
|
66
|
-
fixture = plugins_seen.detect { |p| p[:name] == "inspec-test-fixture" }
|
67
|
-
refute_nil fixture
|
68
|
-
assert_equal "gem (user)", fixture[:type]
|
69
|
-
assert_equal "0.1.0", fixture[:version]
|
70
|
-
|
71
|
-
assert_exit_code 0, result
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_list_when_a_train_plugin_is_installed
|
75
|
-
pre_block = Proc.new do |plugin_statefile_data, tmp_dir|
|
76
|
-
plugin_statefile_data.clear # Signal not to write a file, we'll provide one.
|
77
|
-
copy_in_core_config_dir("train-test-fixture", tmp_dir)
|
78
|
-
end
|
79
|
-
|
80
|
-
result = run_inspec_process_with_this_plugin("plugin list --user ", pre_run: pre_block)
|
81
|
-
skip_windows!
|
82
|
-
|
83
|
-
assert_empty result.stderr
|
84
|
-
plugins_seen = parse_plugin_list_lines(result.stdout)
|
85
|
-
assert_equal 1, plugins_seen.count
|
86
|
-
assert_includes result.stdout, "1 plugin(s) total", "list train should show one plugins"
|
87
|
-
|
88
|
-
# Plugin Name Version Via ApiVer
|
89
|
-
# -------------------------------------------------------------
|
90
|
-
# train-test-fixture 0.1.0 gem (user) train-1
|
91
|
-
# -------------------------------------------------------------
|
92
|
-
# 1 plugin(s) total
|
93
|
-
train_plugin = plugins_seen.detect { |p| p[:name] == "train-test-fixture" }
|
94
|
-
refute_nil train_plugin
|
95
|
-
assert_equal "gem (user)", train_plugin[:type]
|
96
|
-
assert_equal "train-1", train_plugin[:generation]
|
97
|
-
assert_equal "0.1.0", train_plugin[:version]
|
98
|
-
|
99
|
-
assert_exit_code 0, result
|
100
|
-
end
|
101
|
-
end
|
@@ -1,129 +0,0 @@
|
|
1
|
-
require_relative "helper"
|
2
|
-
|
3
|
-
class PluginManagerCliSearch < Minitest::Test
|
4
|
-
include CorePluginFunctionalHelper
|
5
|
-
include PluginManagerHelpers
|
6
|
-
|
7
|
-
parallelize_me!
|
8
|
-
|
9
|
-
# TODO: Thor can't hide options, but we wish it could.
|
10
|
-
# def test_search_include_fixture_hidden_option
|
11
|
-
# result = run_inspec_process_with_this_plugin('plugin help search')
|
12
|
-
# refute_includes result.stdout, '--include-test-fixture'
|
13
|
-
# end
|
14
|
-
|
15
|
-
def test_search_for_a_real_gem_with_full_name_no_options
|
16
|
-
result = run_inspec_process("plugin search --include-test-fixture inspec-test-fixture")
|
17
|
-
|
18
|
-
assert_includes result.stdout, "inspec-test-fixture", "Search result should contain the gem name"
|
19
|
-
assert_includes result.stdout, "1 plugin(s) found", "Search result should find 1 plugin"
|
20
|
-
line = result.stdout.split("\n").grep(/inspec-test-fixture/).first
|
21
|
-
assert_match(/\s*inspec-test-fixture\s+\((\d+\.\d+\.\d+){1}\)/, line, "Plugin line should include name and exactly one version")
|
22
|
-
|
23
|
-
assert_exit_code 0, result
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_search_for_a_real_gem_with_stub_name_no_options
|
27
|
-
result = run_inspec_process("plugin search --include-test-fixture inspec-test-")
|
28
|
-
|
29
|
-
assert_includes result.stdout, "inspec-test-fixture", "Search result should contain the gem name"
|
30
|
-
assert_includes result.stdout, "1 plugin(s) found", "Search result should find 1 plugin"
|
31
|
-
|
32
|
-
line = result.stdout.split("\n").grep(/inspec-test-fixture/).first
|
33
|
-
assert_match(/\s*inspec-test-fixture\s+\((\d+\.\d+\.\d+){1}\)/, line, "Plugin line should include name and exactly one version")
|
34
|
-
|
35
|
-
assert_exit_code 0, result
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_search_for_a_real_gem_with_full_name_and_exact_option
|
39
|
-
result = run_inspec_process("plugin search --exact --include-test-fixture inspec-test-fixture")
|
40
|
-
|
41
|
-
assert_includes result.stdout, "inspec-test-fixture", "Search result should contain the gem name"
|
42
|
-
assert_includes result.stdout, "1 plugin(s) found", "Search result should find 1 plugin"
|
43
|
-
|
44
|
-
assert_exit_code 0, result
|
45
|
-
|
46
|
-
# TODO: split
|
47
|
-
result = run_inspec_process("plugin search -e --include-test-fixture inspec-test-fixture")
|
48
|
-
|
49
|
-
assert_exit_code 0, result
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_search_for_a_real_gem_with_stub_name_and_exact_option
|
53
|
-
result = run_inspec_process("plugin search --exact --include-test-fixture inspec-test-")
|
54
|
-
|
55
|
-
assert_includes result.stdout, "0 plugin(s) found", "Search result should find 0 plugins"
|
56
|
-
|
57
|
-
assert_exit_code 2, result
|
58
|
-
|
59
|
-
# TODO: split
|
60
|
-
result = run_inspec_process("plugin search -e --include-test-fixture inspec-test-")
|
61
|
-
|
62
|
-
assert_exit_code 2, result
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_search_for_a_real_gem_with_full_name_and_all_option
|
66
|
-
result = run_inspec_process("plugin search --all --include-test-fixture inspec-test-fixture")
|
67
|
-
assert_includes result.stdout, "inspec-test-fixture", "Search result should contain the gem name"
|
68
|
-
assert_includes result.stdout, "1 plugin(s) found", "Search result should find 1 plugin"
|
69
|
-
|
70
|
-
line = result.stdout.split("\n").grep(/inspec-test-fixture/).first
|
71
|
-
assert_match(/\s*inspec-test-fixture\s+\((\d+\.\d+\.\d+(,\s)?){2,}\)/, line, "Plugin line should include name and at least two versions")
|
72
|
-
|
73
|
-
assert_exit_code 0, result
|
74
|
-
|
75
|
-
# TODO: split
|
76
|
-
result = run_inspec_process("plugin search -a --include-test-fixture inspec-test-fixture")
|
77
|
-
|
78
|
-
assert_exit_code 0, result
|
79
|
-
end
|
80
|
-
|
81
|
-
def test_search_for_a_gem_with_missing_prefix
|
82
|
-
result = run_inspec_process("plugin search --include-test-fixture test-fixture")
|
83
|
-
assert_exit_code 1, result
|
84
|
-
assert_includes result.stdout, "All inspec plugins must begin with either 'inspec-' or 'train-'"
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_search_for_a_gem_that_does_not_exist
|
88
|
-
result = run_inspec_process("plugin search --include-test-fixture inspec-test-fixture-nonesuch")
|
89
|
-
|
90
|
-
assert_includes result.stdout, "0 plugin(s) found", "Search result should find 0 plugins"
|
91
|
-
|
92
|
-
assert_exit_code 2, result
|
93
|
-
end
|
94
|
-
|
95
|
-
def test_search_for_a_real_gem_with_full_name_no_options_and_train_name
|
96
|
-
result = run_inspec_process("plugin search --include-test-fixture train-test-fixture")
|
97
|
-
|
98
|
-
assert_includes result.stdout, "train-test-fixture", "Search result should contain the gem name"
|
99
|
-
assert_includes result.stdout, "1 plugin(s) found", "Search result should find 1 plugin"
|
100
|
-
line = result.stdout.split("\n").grep(/train-test-fixture/).first
|
101
|
-
assert_match(/\s*train-test-fixture\s+\((\d+\.\d+\.\d+){1}\)/, line, "Plugin line should include name and exactly one version")
|
102
|
-
|
103
|
-
assert_exit_code 0, result
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_search_omit_excluded_inspec_plugins
|
107
|
-
result = run_inspec_process("plugin search --include-test-fixture inspec-")
|
108
|
-
|
109
|
-
assert_includes result.stdout, "inspec-test-fixture", "Search result should contain the test gem"
|
110
|
-
%w{
|
111
|
-
inspec-core
|
112
|
-
inspec-multi-server
|
113
|
-
}.each do |plugin_name|
|
114
|
-
refute_includes result.stdout, plugin_name, "Search result should not contain excluded gems"
|
115
|
-
end
|
116
|
-
|
117
|
-
assert_exit_code 0, result
|
118
|
-
end
|
119
|
-
|
120
|
-
def test_search_for_a_real_gem_with_full_name_no_options_filter_fixtures
|
121
|
-
result = run_inspec_process("plugin search inspec-test-fixture")
|
122
|
-
refute_includes result.stdout, "inspec-test-fixture", "Search result should not contain the fixture gem name"
|
123
|
-
end
|
124
|
-
|
125
|
-
def test_search_for_a_real_gem_with_full_name_no_options_filter_fixtures_train
|
126
|
-
result = run_inspec_process("plugin search train-test-fixture")
|
127
|
-
refute_includes result.stdout, "train-test-fixture", "Search result should not contain the fixture gem name"
|
128
|
-
end
|
129
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require_relative "helper"
|
2
|
-
|
3
|
-
class PluginManagerCliUninstall < Minitest::Test
|
4
|
-
include CorePluginFunctionalHelper
|
5
|
-
include PluginManagerHelpers
|
6
|
-
|
7
|
-
def test_when_a_gem_plugin_can_be_uninstalled
|
8
|
-
pre_block = Proc.new do |plugin_statefile_data, tmp_dir|
|
9
|
-
plugin_statefile_data.clear # Signal not to write a file, we'll provide one.
|
10
|
-
copy_in_core_config_dir("test-fixture-1-float", tmp_dir)
|
11
|
-
end
|
12
|
-
|
13
|
-
# Attempt uninstall
|
14
|
-
uninstall_result = run_inspec_process_with_this_plugin("plugin uninstall inspec-test-fixture", pre_run: pre_block, post_run: list_after_run)
|
15
|
-
|
16
|
-
success_message = uninstall_result.stdout.split("\n").grep(/uninstalled/).last
|
17
|
-
skip_windows!
|
18
|
-
refute_nil success_message, "Should find a success message at the end"
|
19
|
-
assert_includes success_message, "inspec-test-fixture"
|
20
|
-
assert_includes success_message, "0.1.0"
|
21
|
-
assert_includes success_message, "has been uninstalled"
|
22
|
-
|
23
|
-
itf_plugins = @list_result.select { |p| p[:name] == "inspec-test-fixture" }
|
24
|
-
assert_empty itf_plugins, "inspec-test-fixture should not appear in the output of inspec list"
|
25
|
-
|
26
|
-
assert_empty uninstall_result.stderr
|
27
|
-
assert_exit_code 0, uninstall_result
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_when_a_path_plugin_can_be_uninstalled
|
31
|
-
pre_block = Proc.new do |plugin_statefile_data, tmp_dir|
|
32
|
-
plugin_statefile_data.clear # Signal not to write a file, we'll provide one.
|
33
|
-
# This fixture includes a path install for inspec-meaning-of-life
|
34
|
-
copy_in_core_config_dir("test-fixture-1-float", tmp_dir)
|
35
|
-
end
|
36
|
-
uninstall_result = run_inspec_process_with_this_plugin("plugin uninstall inspec-meaning-of-life", pre_run: pre_block, post_run: list_after_run)
|
37
|
-
skip_windows!
|
38
|
-
|
39
|
-
success_message = uninstall_result.stdout.split("\n").grep(/uninstalled/).last
|
40
|
-
refute_nil success_message, "Should find a success message at the end"
|
41
|
-
assert_includes success_message, "inspec-meaning-of-life"
|
42
|
-
assert_includes success_message, "path-based plugin install"
|
43
|
-
assert_includes success_message, "has been uninstalled"
|
44
|
-
|
45
|
-
itf_plugins = @list_result.select { |p| p[:name] == "inspec-meaning-of-life" }
|
46
|
-
assert_empty itf_plugins, "inspec-meaning-of-life should not appear in the output of inspec list"
|
47
|
-
|
48
|
-
assert_empty uninstall_result.stderr
|
49
|
-
assert_exit_code 0, uninstall_result
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_fail_uninstall_from_plugin_that_is_not_installed
|
53
|
-
uninstall_result = run_inspec_process_with_this_plugin("plugin uninstall inspec-test-fixture-nonesuch")
|
54
|
-
|
55
|
-
skip_windows!
|
56
|
-
refute_includes "Inspec::Plugin::V2::UnInstallError", uninstall_result.stdout # Stacktrace marker
|
57
|
-
assert_match(/No such plugin installed:.+ - uninstall failed/, uninstall_result.stdout)
|
58
|
-
|
59
|
-
assert_empty uninstall_result.stderr
|
60
|
-
|
61
|
-
assert_exit_code 1, uninstall_result
|
62
|
-
end
|
63
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
require_relative "helper"
|
2
|
-
|
3
|
-
class PluginManagerCliUpdate < Minitest::Test
|
4
|
-
include CorePluginFunctionalHelper
|
5
|
-
include PluginManagerHelpers
|
6
|
-
|
7
|
-
def test_when_a_plugin_can_be_updated
|
8
|
-
skip "this test requires bundler to pass" unless defined? ::Bundler
|
9
|
-
|
10
|
-
pre_block = Proc.new do |plugin_statefile_data, tmp_dir|
|
11
|
-
plugin_statefile_data.clear # Signal not to write a file, we'll provide one.
|
12
|
-
copy_in_core_config_dir("test-fixture-1-float", tmp_dir)
|
13
|
-
end
|
14
|
-
|
15
|
-
update_result = run_inspec_process_with_this_plugin("plugin update inspec-test-fixture", pre_run: pre_block, post_run: list_after_run)
|
16
|
-
|
17
|
-
success_message = update_result.stdout.split("\n").grep(/updated/).last
|
18
|
-
skip_windows!
|
19
|
-
refute_nil success_message, "Should find a success message at the end"
|
20
|
-
assert_includes success_message, "inspec-test-fixture"
|
21
|
-
assert_includes success_message, "0.1.0"
|
22
|
-
assert_includes success_message, "0.2.0"
|
23
|
-
assert_includes success_message, "updated from rubygems.org"
|
24
|
-
|
25
|
-
itf_plugin = @list_result.detect { |p| p[:name] == "inspec-test-fixture" }
|
26
|
-
refute_nil itf_plugin, "plugin name should now appear in the output of inspec list"
|
27
|
-
assert_equal "gem (user)", itf_plugin[:type]
|
28
|
-
assert_equal "0.2.0", itf_plugin[:version]
|
29
|
-
|
30
|
-
assert_empty update_result.stderr
|
31
|
-
assert_exit_code 0, update_result
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_refuse_update_when_already_current
|
35
|
-
pre_block = Proc.new do |plugin_statefile_data, tmp_dir|
|
36
|
-
plugin_statefile_data.clear # Signal not to write a file, we'll provide one.
|
37
|
-
copy_in_core_config_dir("test-fixture-2-float", tmp_dir)
|
38
|
-
end
|
39
|
-
|
40
|
-
update_result = run_inspec_process_with_this_plugin("plugin update inspec-test-fixture", pre_run: pre_block)
|
41
|
-
|
42
|
-
refusal_message = update_result.stdout.split("\n").grep(/refusing/).last
|
43
|
-
skip_windows!
|
44
|
-
refute_nil refusal_message, "Should find a failure message at the end"
|
45
|
-
assert_includes refusal_message, "inspec-test-fixture"
|
46
|
-
assert_includes refusal_message, "0.2.0"
|
47
|
-
assert_includes refusal_message, "Already installed at latest version"
|
48
|
-
|
49
|
-
assert_empty update_result.stderr
|
50
|
-
|
51
|
-
assert_exit_code 2, update_result
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_fail_update_from_nonexistant_gem
|
55
|
-
update_result = run_inspec_process_with_this_plugin("plugin update inspec-test-fixture-nonesuch")
|
56
|
-
|
57
|
-
skip_windows!
|
58
|
-
assert_match(/No such plugin installed:.+ - update failed/, update_result.stdout)
|
59
|
-
|
60
|
-
assert_empty update_result.stderr
|
61
|
-
|
62
|
-
assert_exit_code 1, update_result
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_fail_update_path
|
66
|
-
pre_block = Proc.new do |plugin_statefile_data, tmp_dir|
|
67
|
-
plugin_statefile_data.clear # Signal not to write a file, we'll provide one.
|
68
|
-
copy_in_core_config_dir("meaning_by_path", tmp_dir)
|
69
|
-
end
|
70
|
-
|
71
|
-
update_result = run_inspec_process_with_this_plugin("plugin update inspec-meaning-of-life", pre_run: pre_block)
|
72
|
-
|
73
|
-
refusal_message = update_result.stdout.split("\n").grep(/refusing/).last
|
74
|
-
skip_windows!
|
75
|
-
refute_nil refusal_message, "Should find a failure message at the end"
|
76
|
-
assert_includes refusal_message, "inspec-meaning-of-life"
|
77
|
-
assert_includes refusal_message, "inspec plugin uninstall"
|
78
|
-
assert_includes refusal_message, "Cannot update path-based install"
|
79
|
-
|
80
|
-
assert_empty update_result.stderr
|
81
|
-
|
82
|
-
assert_exit_code 2, update_result
|
83
|
-
end
|
84
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
require_relative "../../../shared/core_plugin_test_helper.rb"
|
2
|
-
|
3
|
-
#-----------------------------------------------------------------------#
|
4
|
-
# Thor option defs
|
5
|
-
#-----------------------------------------------------------------------#
|
6
|
-
class PluginManagerCliOptions < Minitest::Test
|
7
|
-
include CorePluginUnitHelper
|
8
|
-
let(:cli_class) { InspecPlugins::PluginManager::CliCommand }
|
9
|
-
|
10
|
-
def setup
|
11
|
-
require_relative "../../lib/inspec-plugin-manager-cli/cli_command"
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_list_args
|
15
|
-
arg_config = cli_class.all_commands["list"].options
|
16
|
-
assert_equal 4, arg_config.count, "The list command should have 4 options"
|
17
|
-
|
18
|
-
{ u: :user, a: :all, c: :core, s: :system }.each do |abbrev, option|
|
19
|
-
assert_includes arg_config.keys, option, "The list command should have an --#{option} option"
|
20
|
-
assert_equal :boolean, arg_config[option].type, "The --#{option} option should be boolean"
|
21
|
-
assert_equal abbrev, arg_config[option].aliases.first, "The --#{option} option should be aliased as -#{abbrev}"
|
22
|
-
refute_nil arg_config[option].description, "The --#{option} option should have a description"
|
23
|
-
refute arg_config[option].required, "The --#{option} option should not be required"
|
24
|
-
end
|
25
|
-
|
26
|
-
assert_equal 0, cli_class.instance_method(:list).arity, "The list command should take no arguments"
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_search_args
|
30
|
-
arg_config = cli_class.all_commands["search"].options
|
31
|
-
assert_equal 3, arg_config.count, "The search command should have 3 options"
|
32
|
-
|
33
|
-
assert_includes arg_config.keys, :all, "The search command should have an --all option"
|
34
|
-
assert_equal :boolean, arg_config[:all].type, "The --all option should be boolean"
|
35
|
-
assert_equal :a, arg_config[:all].aliases.first, "The --all option should be aliased as -a"
|
36
|
-
refute_nil arg_config[:all].description, "The --all option should have a description"
|
37
|
-
refute arg_config[:all].required, "The --all option should not be required"
|
38
|
-
|
39
|
-
assert_includes arg_config.keys, :exact, "The search command should have an --exact option"
|
40
|
-
assert_equal :boolean, arg_config[:exact].type, "The --exact option should be boolean"
|
41
|
-
assert_equal :e, arg_config[:exact].aliases.first, "The --exact option should be aliased as -e"
|
42
|
-
refute_nil arg_config[:exact].description, "The --exact option should have a description"
|
43
|
-
refute arg_config[:exact].required, "The --exact option should not be required"
|
44
|
-
|
45
|
-
assert_includes arg_config.keys, :'include-test-fixture', "The search command should have an --include-test-fixture option"
|
46
|
-
assert_equal :boolean, arg_config[:'include-test-fixture'].type, "The --include-test-fixture option should be boolean"
|
47
|
-
refute arg_config[:'include-test-fixture'].required, "The --include-test-fixture option should not be required"
|
48
|
-
|
49
|
-
assert_equal 1, cli_class.instance_method(:search).arity, "The search command should take one argument"
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_install_args
|
53
|
-
arg_config = cli_class.all_commands["install"].options
|
54
|
-
assert_equal 1, arg_config.count, "The install command should have 1 option"
|
55
|
-
|
56
|
-
assert_includes arg_config.keys, :version, "The install command should have a --version option"
|
57
|
-
assert_equal :string, arg_config[:version].type, "The --version option should be a string"
|
58
|
-
assert_equal :v, arg_config[:version].aliases.first, "The --version option should be aliased as -v"
|
59
|
-
refute_nil arg_config[:version].description, "The --version option should have a description"
|
60
|
-
refute arg_config[:version].required, "The --version option should not be required"
|
61
|
-
|
62
|
-
assert_equal 1, cli_class.instance_method(:install).arity, "The install command should take one argument"
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_update_args
|
66
|
-
# TODO: allow specifying version
|
67
|
-
arg_config = cli_class.all_commands["update"].options
|
68
|
-
assert_equal 0, arg_config.count, "The update command should have no options"
|
69
|
-
assert_equal 1, cli_class.instance_method(:update).arity, "The update command should take one argument"
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_uninstall_args
|
73
|
-
arg_config = cli_class.all_commands["uninstall"].options
|
74
|
-
assert_equal 0, arg_config.count, "The uninstall command should have no options"
|
75
|
-
assert_equal 1, cli_class.instance_method(:uninstall).arity, "The uninstall command should take one argument"
|
76
|
-
end
|
77
|
-
end
|