inspec/test/unit/resources
jtimberman d7fad68541 add "packages" resource
This pull request adds a packages resource so that we can check for pattern matches against all the packages on a system. This initially implements only dpkg support for debian-based platforms so we can cover this use case:

```ruby
describe packages(/^xserver-xorg.*/) do
  its("list") { should be_empty }
end
```

This uses FilterTable so we can supply additional queries, too.

```ruby
describe packages(/vi.+/).where { status != 'installed' } do
  its('statuses') { should be_empty }
end
```

Users can specify the name as a string or a regular expression. If it is a string, we will escape it and convert it to a regular expression to use in matching against the full returned list of packages. If it is a regular expression, we take that as is and use it to filter the results.

While some package management systems such as `dpkg` can take a shell glob argument to filter their results, we eschew this and require a regular expression to match multiple package names because we will need this to work across other platforms in the future. This means that the following:

```ruby
packages("vim")
```

Will return *all* the "vim" packages on the system. The `packages` resource will take `"vim"`, turn it into `/vim/`, and greedily match anything with "vim" in the name. To match only a single package named `vim`, it needs to be an anchored regular expression.

```ruby
packages(/^vim$/)
```

Signed-off-by: Joshua Timberman <joshua@chef.io>

Use entries instead of list

Added a few more tests and non installed package in output
Signed-off-by: Alex Pop <apop@chef.io>

fix lint

Signed-off-by: Alex Pop <apop@chef.io>

Signed-off-by: Joshua Timberman <joshua@chef.io>
2017-02-07 10:29:11 +00:00
..
apache_conf_test.rb In ApacheConf#include_files, check for abs paths 2016-09-20 09:11:09 -04:00
apt_test.rb Some further tests for Mint 2016-10-08 23:34:56 +02:00
audit_policy_test.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
auditd_conf_test.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
auditd_rules_test.rb auditd_rules: access by key, tests + documentation 2016-02-09 11:51:52 +01:00
bash_test.rb remodel bash and shell wrappers 2016-04-18 11:48:42 -04:00
bond_test.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
bridge_test.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
csv_test.rb extend csv tests, remove dot-resolver 2015-10-27 15:58:02 +01:00
etc_group_test.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
file_test.rb refactored file resource unit tests 2016-10-26 15:57:30 +02:00
gem_test.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
group_test.rb implement filter table for group/groups resource 2016-09-23 00:53:24 +02:00
grub_conf_test.rb added default and per kernel checking 2016-04-17 10:46:35 -04:00
host_test.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
http_test.rb switch to faraday as http backend 2017-02-02 22:13:36 +01:00
inetd_conf_test.rb rename inetd_config -> inetd_conf 2015-10-26 16:21:51 +01:00
ini_test.rb implement unit tests for ini resource 2015-11-24 16:46:17 +01:00
interface_test.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
iptables_test.rb iptables unit test: add comment examples 2016-02-10 09:57:32 +01:00
json_test.rb Fix variable name. Add test. 2016-12-15 08:00:56 -05:00
kernel_module_test.rb Add version method to kernel_module 2017-01-27 13:33:41 +03:00
kernel_parameter_test.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
limits_conf_test.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
login_def_test.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
mount_test.rb rename internal File -> FileResource 2016-03-09 10:48:48 +01:00
mysql_conf_test.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
npm_test.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
ntp_conf_test.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
oneget_test.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
os_env_test.rb Add Windows support to the os_env resource 2015-11-19 15:41:00 +01:00
os_test.rb Some further tests for Mint 2016-10-08 23:34:56 +02:00
package_test.rb Merge pull request #1387 from jvrplmlmn/package-brew-unit-test 2017-01-03 12:24:46 +01:00
packages_test.rb add "packages" resource 2017-02-07 10:29:11 +00:00
parse_config_test.rb add params and content method to parse_config 2016-08-05 12:13:56 +02:00
passwd_test.rb use filtertable with passwd resource 2016-05-04 15:27:58 +02:00
pip_test.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
port_test.rb make netstat default for getting ports and get only listening ones 2016-08-12 16:02:56 +01:00
powershell_test.rb fix powershell based unit tests 2016-09-05 13:36:48 +02:00
processes_test.rb update the tests to reflect the list->entries migration and where support 2017-02-03 08:28:46 +00:00
registry_key_test.rb update unit test 2015-11-17 22:28:11 +01:00
security_policy_test.rb use simple config for security policy resource 2016-09-12 12:20:57 +02:00
service_test.rb Linux Mint support for service resource 2016-10-08 23:34:56 +02:00
shadow_test.rb add shadow resource for /etc/shadow 2016-02-19 14:26:04 +01:00
ssh_conf_test.rb cleanup 2016-08-16 10:01:10 +02:00
sys_info_test.rb add unit tests 2016-09-09 12:43:03 +02:00
user_test.rb replace wmi win32_useraccount with adsi users 2016-09-26 01:31:44 +02:00
vbscript_test.rb fix powershell based unit tests 2016-09-05 13:36:48 +02:00
windows_feature.rb rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
windows_task_test.rb Added unit tests, only took most of the night :) 2016-11-20 20:07:59 +00:00
wmi_test.rb improve wmi resource 2016-06-19 23:40:45 +02:00
xinetd_test.rb derive xinetd protocol from socket_type when not defined in the config file 2017-02-01 11:19:24 +00:00
yaml_test.rb extend yaml tests, remove dot-resolver 2015-10-27 15:58:02 +01:00
yum_test.rb Yum.repo should show correct name 2017-01-04 11:10:38 +09:00