Commit Graph

49 Commits

Author SHA1 Message Date
Bo Maryniuk
16419ec6d3 Add check on gen_locale for Suse-specific path 2018-01-31 13:00:12 +01:00
Bo Maryniuk
58dde2ccbc Add unit test for gen_locale on Suse os_family with invalid locale 2018-01-31 12:54:42 +01:00
Bo Maryniuk
00f2695c79 Lintfix W1699: Python3 incompat 2018-01-31 10:19:04 +01:00
Bo Maryniuk
d423df4ded Lintfix E8301: expected 1 blank line 2018-01-31 10:17:44 +01:00
Bo Maryniuk
ea0b2e171f Lintfix: E8302, PEP8 expected two blank lines 2018-01-31 10:17:04 +01:00
Bo Maryniuk
13087b2062 Fix unit test: capture log message and redirect it to the test assertion 2018-01-30 21:14:04 +01:00
Bo Maryniuk
8a9dacc30b Fix unit tests for HAS_DBUS removal 2018-01-30 21:05:00 +01:00
Bo Maryniuk
56f5645a09 Add unit test for localectl on arbitrary structure parser 2018-01-30 20:59:23 +01:00
Bo Maryniuk
5af33fbb0d Add unit test for localectl output parse on broken content 2018-01-30 20:51:23 +01:00
Bo Maryniuk
bcd04fa0ab Add log call verification 2018-01-30 20:47:26 +01:00
Bo Maryniuk
4f39075883 Add unit test for calling localectl parser on an empty output 2018-01-30 20:47:04 +01:00
Bo Maryniuk
a5d3098e9e Add unit test for localectl output status parser when no systemd installed 2018-01-30 20:38:33 +01:00
Bo Maryniuk
b4b0ea7d58 Add unit test for localectl output status parser 2018-01-30 20:36:17 +01:00
Bo Maryniuk
ec4ef24cd3 Add unit test for set_locale on unknown system 2018-01-30 19:16:15 +01:00
Bo Maryniuk
98c5ed8ef6 Remove an old unit test for set_locale 2018-01-30 19:15:54 +01:00
Bo Maryniuk
bdff4dc74c Fix system tuning conditions 2018-01-30 19:15:26 +01:00
Bo Maryniuk
e78dd78247 Add unit test for solaris when list_avail does not return proper locale 2018-01-30 19:07:40 +01:00
Bo Maryniuk
67d287316c Add unit test on solaris with list_avail returning proper locale 2018-01-30 18:58:44 +01:00
Bo Maryniuk
2e07701a0a Add unit test for set_locale on Gentoo system without systemd 2018-01-30 18:52:37 +01:00
Bo Maryniuk
a5acac5fc7 Add unit test for set_locale on Debian without systemd 2018-01-30 18:48:14 +01:00
Bo Maryniuk
cfb25f0e90 Add unit test for set_locale on RedHat systems without systemd 2018-01-30 18:45:55 +01:00
Bo Maryniuk
b1e8606d02 Add unit test with systemd and dbus enabled on SLE12 2018-01-30 18:43:01 +01:00
Bo Maryniuk
ceda257846 Add unit test for set_locale with dbus and systemd on any platform 2018-01-30 18:34:06 +01:00
Bo Maryniuk
b91ee79ef6 Add unit test for set_locale on any system with systemd and no dbus available 2018-01-30 18:32:34 +01:00
Bo Maryniuk
5bb80575d1 Fix unit test for calling a proper function while parsing localectl 2018-01-30 17:32:37 +01:00
Bo Maryniuk
b73c1d7308 Add unit test for calling unknown platform 2018-01-30 17:32:14 +01:00
Bo Maryniuk
d82b60a807 Add unit test for get_locale on Solaris 2018-01-30 17:28:28 +01:00
Bo Maryniuk
11805e47af Add unit test for get_locale on gentoo 2018-01-30 17:27:26 +01:00
Bo Maryniuk
933b365010 Add unit test for get_locale on Debian without systemd/dbus 2018-01-30 17:26:26 +01:00
Bo Maryniuk
409de1e5f6 Fix docstring on RedHat unit test for get_locale 2018-01-30 17:26:05 +01:00
Bo Maryniuk
7c19e235b1 Add unit test for get_locale on redhat systems with no systemd 2018-01-30 17:24:04 +01:00
Bo Maryniuk
df16df3abf Disable salt.utils.systemd.booted to be actually called 2018-01-30 17:23:40 +01:00
Bo Maryniuk
b3fff6744c Add unit test for getting locale on SLE12 with systemd and dbus available 2018-01-30 17:18:13 +01:00
Bo Maryniuk
22630b7a32 Fix doc for unit test 2018-01-30 17:17:46 +01:00
Bo Maryniuk
0ef739b8a7 Add unit test calling get_locale with systemd and dbus available 2018-01-30 17:06:10 +01:00
Bo Maryniuk
3c37cfd76a Add unit test calling get_locale with systemd but no dbus available 2018-01-30 17:04:37 +01:00
Bo Maryniuk
197586230a Skip tests if there is no pytest installed 2018-01-30 17:03:58 +01:00
rallytime
10b7b0601d
Add unicode_literals to more modules, states, and tests 2018-01-23 10:08:59 -05:00
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
rallytime
ff0def408b Whitespace fix 2017-05-25 10:26:06 -06:00
rallytime
9ff2694155 Merge branch '2016.11' into 'nitrogen'
Conflicts:
  - pkg/salt-minion.service
  - salt/modules/junos.py
  - salt/modules/localemod.py
  - salt/modules/win_system.py
  - salt/states/junos.py
  - tests/unit/modules/test_localemod.py
  - tests/unit/modules/test_win_powercfg.py
  - tests/unit/states/dockerng_test.py
2017-05-24 16:32:59 -06:00
Pedro Algarvio
abe608d739
Drop @patch usage 2017-04-28 13:36:42 +01:00
Pedro Algarvio
06bc81dc3d
Proper mocking. 2017-04-01 14:22:58 +01:00
Pedro Algarvio
d397763553
Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
Pedro Algarvio
9b1e55aa85
Import the full module namespace to avoid import shadowing.
https://github.com/saltstack/salt/pull/39996#issuecomment-287857698
2017-03-28 19:02:47 +01:00
Pedro Algarvio
1f7a0aa65b
Proper mocking 2017-03-28 19:00:51 +01:00
Pedro Algarvio
40a64191a1
Absolute imports and A LOT of code cleanup. 2017-03-01 01:33:07 +00:00
Pedro Algarvio
3beb3fb801
Move whatever we need from salttesting to salt.
Let's drop the salttesting dependency cycle.
2017-02-28 22:52:49 +00:00
Pedro Algarvio
15af4c9728
Test filenames conformity. Adjust for pytest. 2017-02-23 23:19:42 +00:00