salt/tests/unit/states
Erik Johnson 3184168365 Use explicit unicode strings + break up salt.utils
This PR is part of what will be an ongoing effort to use explicit
unicode strings in Salt. Because Python 3 does not suport Python 2's raw
unicode string syntax (i.e. `ur'\d+'`), we must use
`salt.utils.locales.sdecode()` to ensure that the raw string is unicode.
However, because of how `salt/utils/__init__.py` has evolved into the
hulking monstrosity it is today, this means importing a large module in
places where it is not needed, which could negatively impact
performance. For this reason, this PR also breaks out some of the
functions from `salt/utils/__init__.py` into new/existing modules under
`salt/utils/`. The long term goal will be that the modules within this
directory do not depend on importing `salt.utils`.

A summary of the changes in this PR is as follows:

* Moves the following functions from `salt.utils` to new locations
  (including a deprecation warning if invoked from `salt.utils`):
  `to_bytes`, `to_str`, `to_unicode`, `str_to_num`, `is_quoted`,
  `dequote`, `is_hex`, `is_bin_str`, `rand_string`,
  `contains_whitespace`, `clean_kwargs`, `invalid_kwargs`, `which`,
  `which_bin`, `path_join`, `shlex_split`, `rand_str`, `is_windows`,
  `is_proxy`, `is_linux`, `is_darwin`, `is_sunos`, `is_smartos`,
  `is_smartos_globalzone`, `is_smartos_zone`, `is_freebsd`, `is_netbsd`,
  `is_openbsd`, `is_aix`
* Moves the functions already deprecated by @rallytime to the bottom of
  `salt/utils/__init__.py` for better organization, so we can keep the
  deprecated ones separate from the ones yet to be deprecated as we
  continue to break up `salt.utils`
* Updates `salt/*.py` and all files under `salt/client/` to use explicit
  unicode string literals.
* Gets rid of implicit imports of `salt.utils` (e.g. `from salt.utils
  import foo` becomes `import salt.utils.foo as foo`).
* Renames the `test.rand_str` function to `test.random_hash` to more
  accurately reflect what it does
* Modifies `salt.utils.stringutils.random()` (née `salt.utils.rand_string()`)
  such that it returns a string matching the passed size. Previously
  this function would get `size` bytes from `os.urandom()`,
  base64-encode it, and return the result, which would in most cases not
  be equal to the passed size.
2017-08-08 13:33:43 -05:00
..
__init__.py Include the python encoding file header on tests. 2013-11-27 11:19:24 +00:00
test_alias.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_alternatives.py Merge branch '2016.11' into 'develop' 2017-03-28 17:09:30 -06:00
test_apache_conf.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_apache_module.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_apache_site.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_apache.py Update unit test mocks for salt.utils.files.fopen 2017-07-18 13:40:07 -06:00
test_apt.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_archive.py fix tests 2017-07-27 12:00:38 -06:00
test_artifactory.py Merge branch '2016.11' into 'develop' 2017-04-05 13:02:14 -06:00
test_at.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_augeas.py Update all references for moved functions to use "files" util 2017-07-18 10:31:01 -06:00
test_aws_sqs.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_blockdev.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_boto_apigateway.py Update all references for moved functions to use "files" util 2017-07-18 10:31:01 -06:00
test_boto_asg.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_boto_cloudtrail.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_boto_cloudwatch_alarm.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_boto_cloudwatch_event.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_boto_cognitoidentity.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_boto_dynamodb.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_boto_ec2.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_boto_elasticache.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_boto_elasticsearch_domain.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_boto_elb.py INFRA-4842 - /thought/ I fixed this :) 2017-05-23 12:04:19 -04:00
test_boto_iam_role.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_boto_iot.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_boto_kinesis.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_boto_lambda.py fixed unit test failures. 2017-05-16 15:09:00 -07:00
test_boto_lc.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_boto_route53.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_boto_s3_bucket.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_boto_secgroup.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_boto_sns.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_boto_sqs.py Modernize boto_sqs execution and state modules 2017-07-31 18:08:29 +00:00
test_boto_vpc.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_bower.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_chef.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_cloud.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_cmd.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_composer.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_cron.py Fixed cron tests 2017-06-08 16:15:49 -06:00
test_cyg.py Absolute imports and A LOT of code cleanup. 2017-03-01 01:33:07 +00:00
test_ddns.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_debconfmod.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_disk.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_docker_image.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_docker_network.py Merge branch '2017.7' into 'develop' 2017-08-07 10:43:06 -04:00
test_docker_volume.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_drac.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_elasticsearch.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_environ.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_eselect.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_esxdatacenter.py Fixed pylint 2017-07-20 21:06:35 +01:00
test_event.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_file.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_gem.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_glusterfs.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_gnomedesktop.py Import the full module namespace to avoid import shadowing. 2017-03-28 19:02:47 +01:00
test_grafana_datasource.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_grafana.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_grains.py Update all references for moved functions to use "files" util 2017-07-18 10:31:01 -06:00
test_group.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_hg.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_hipchat.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_host.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_htpasswd.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_http.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_incron.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_influxdb08_database.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_influxdb08_user.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_ini_manage.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_ipmi.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_ipset.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_iptables.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_jboss7.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_kapacitor.py Update all references for moved functions to use "files" util 2017-07-18 10:31:01 -06:00
test_kernelpkg.py Convert remaining "assert_called_once" references to new syntax 2017-07-07 10:28:19 -06:00
test_keyboard.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_keystone.py Merge branch '2016.11' into 'nitrogen' 2017-06-05 13:38:51 -06:00
test_kmod.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_layman.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_ldap.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_libcloud_dns.py clean up dns test method 2017-04-29 10:48:04 +10:00
test_libvirt.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_linux_acl.py Updated and added linux_acl_test.present tests 2017-07-24 19:35:06 +01:00
test_locale.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_lvm.py Adding the force option for situation where the -yes argument needs to be passed along to lvcreate 2017-06-15 13:39:17 -07:00
test_lvs_server.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_lvs_service.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_lxc.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_mac_assistive.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_mac_defaults.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_mac_keychain.py Drop @patch usage 2017-04-28 13:36:42 +01:00
test_mac_package.py Drop @patch usage 2017-04-28 13:36:42 +01:00
test_mac_xattr.py Drop @patch usage 2017-04-28 13:36:42 +01:00
test_makeconf.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_mdadm.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_memcached.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_modjk_worker.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_modjk.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_module.py Call unnamed parameters properly 2017-07-13 10:11:00 +02:00
test_mongodb_database.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_mongodb_user.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_mount.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_mysql_grants.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_mysql_query.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_mysql_user.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_network.py Drop @patch usage 2017-04-28 13:36:42 +01:00
test_nftables.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_npm.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_ntp.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_openstack_config.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_openvswitch_port.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_pagerduty.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_pecl.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_pip.py Import for the original module 2017-04-04 18:04:38 +01:00
test_pkgng.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_portage_config.py Drop @patch usage 2017-04-28 13:36:42 +01:00
test_ports.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_postgres_cluster.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_postgres_database.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_postgres_extension.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_postgres_group.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_postgres_initdb.py Proper mocking. 2017-04-01 14:22:59 +01:00
test_postgres_language.py Proper mocking. 2017-04-01 14:22:59 +01:00
test_postgres_privileges.py Proper mocking. 2017-04-01 14:22:59 +01:00
test_postgres_schema.py Fix test_absent unit test. 2017-05-26 16:11:17 -07:00
test_postgres_user.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_postgres.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_powerpath.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_process.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_proxy.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_pyenv.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_pyrax_queues.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_quota.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_rabbitmq_cluster.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_rabbitmq_plugin.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_rabbitmq_policy.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_rabbitmq_vhost.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_rbenv.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_rdp.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_redismod.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_reg.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_rvm.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_saltmod.py [PY3] Make test_saltmod unit tests less flaky for Python 3 2017-07-05 12:56:03 -06:00
test_schedule.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_selinux.py fix test_selinux for issue #42611 2017-07-28 09:39:38 -05:00
test_serverdensity_device.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_service.py Merge branch '2016.11' into 'nitrogen' 2017-05-09 14:32:49 -06:00
test_slack.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_smtp.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_splunk_search.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_ssh_auth.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_ssh_known_hosts.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_status.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_supervisord.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_svn.py Merge branch '2016.11' into '2017.7' 2017-06-16 10:43:02 -06:00
test_sysctl.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_syslog_ng.py Update all references for moved functions to use "files" util 2017-07-18 10:31:01 -06:00
test_sysrc.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_test.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_timezone.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_tomcat.py Merge branch '2016.11' into 'nitrogen' 2017-04-14 10:46:56 -06:00
test_user.py Fix unit test 2017-05-09 16:00:24 -06:00
test_vbox_guest.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_virtualenv_mod.py Drop @patch usage 2017-04-28 13:36:42 +01:00
test_win_certutil.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_win_dism.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_win_dns_client.py Merge branch '2016.11' into 'nitrogen' 2017-05-10 15:32:23 -06:00
test_win_license.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_win_network.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_win_path.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_win_pki.py Update Nitrogen references to 2017.7.0 for states, utils, tests directory 2017-06-14 11:54:27 -06:00
test_win_powercfg.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_win_servermanager.py Fix unit tests 2017-06-23 15:57:47 -06:00
test_win_snmp.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_win_system.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_win_update.py Drop @patch usage 2017-04-28 13:36:42 +01:00
test_winrepo.py Use os.sep for path seps 2017-07-12 10:13:26 -06:00
test_xmpp.py Proper mocking. 2017-03-28 19:04:01 +01:00
test_zcbuildout.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_zk_concurrency.py Proper mocking. 2017-03-28 19:04:01 +01:00