salt/tests/unit/utils
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
..
cache_mods Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
vmware Use explicit unicode strings + break up salt.utils 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_aggregation.py Absolute imports and A LOT of code cleanup. 2017-03-01 01:33:07 +00:00
test_args.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_async.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_boto.py Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
test_cache.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_cloud.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_configcomparer.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_context.py Update all references for moved functions to use "files" util 2017-07-18 10:31:01 -06:00
test_decorators.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_dictupdate.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_disk_cache.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_dns.py DNS2: pylint fixes 2017-04-11 14:52:16 +02:00
test_doc.py Move parse_docstring from salt.utils to salt.utils.doc.py 2017-07-19 12:06:55 -06:00
test_docker.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_etcd_util.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_event.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_extend.py Update all references for moved functions to use "files" util 2017-07-18 10:31:01 -06:00
test_filebuffer.py Absolute imports and A LOT of code cleanup. 2017-03-01 01:33:07 +00:00
test_files.py Update all references for moved functions to use "files" util 2017-07-18 10:31:01 -06:00
test_find.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_format_call.py Stop using deprecated TestCase methods 2017-04-01 14:22:57 +01:00
test_gitfs.py Absolute imports and A LOT of code cleanup. 2017-03-01 01:33:07 +00:00
test_http.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_immutabletypes.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_kwarg_regex.py Absolute imports and A LOT of code cleanup. 2017-03-01 01:33:07 +00:00
test_locales.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_mac_utils.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_minions.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_network.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_parsers.py Merge branch '2016.11' into 'nitrogen' 2017-05-23 10:36:41 -06:00
test_path.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_process.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_reactor.py Update all references for moved functions to use "files" util 2017-07-18 10:31:01 -06:00
test_rsax931.py Absolute imports and A LOT of code cleanup. 2017-03-01 01:33:07 +00:00
test_runtime_whitespace_regex.py Absolute imports and A LOT of code cleanup. 2017-03-01 01:33:07 +00:00
test_safe_walk.py Use the test run temporary path, not the system temporary path 2017-04-04 18:58:21 +01:00
test_sanitizers.py Absolute imports and A LOT of code cleanup. 2017-03-01 01:33:07 +00:00
test_schedule.py Pylint fixes 2017-03-23 10:00:20 -06:00
test_schema.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_stringutils.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_systemd.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_timeout.py Misplaced test. Use tests.support.unit instead. 2017-04-01 14:23:00 +01:00
test_url.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_utils.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_validate_net.py Absolute imports and A LOT of code cleanup. 2017-03-01 01:33:07 +00:00
test_verify.py Update all references for moved functions to use "files" util 2017-07-18 10:31:01 -06:00
test_versions.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_vt.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_warnings.py Stop using deprecated TestCase methods 2017-04-01 14:22:57 +01:00
test_which.py Use explicit unicode strings + break up salt.utils 2017-08-08 13:33:43 -05:00
test_yamlloader.py Update all references for moved functions to use "files" util 2017-07-18 10:31:01 -06:00