Commit Graph

69 Commits

Author SHA1 Message Date
twangboy
b49b52e113
Skip test_load_match on Windows 2018-01-08 14:31:46 -07:00
Eric Radman
10d13062ec
Mock open to /var/log/btmp and /var/log/wtmp
- btmp may not exist
- wtmp may not exist, or it may not contain ASCII data

Unbreaks tests on OpenBSD 6.2
2017-10-21 09:50:08 -04:00
Erik Johnson
877abb89d0
Complete the salt.utils refactor
This moves the remaining 30 functions from salt.utils to new locations.
2017-10-15 09:43:31 -05:00
rallytime
74d315fd28
Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/modules/file.py
  - tests/unit/modules/test_file.py
2017-09-26 13:45:10 -04:00
twangboy
dc1b36b7e2
Change expected return for Windows 2017-09-25 15:06:44 -06:00
Gareth J. Greenaway
ca3f77f81e Adding test_btmp_beacon. 2017-09-22 14:24:31 -07:00
Gareth J. Greenaway
6fe02e3c6c Updating btmp & wtmp beacons to work with python3. Adding ability to fire alerts for specific users & specific times. Adding some unit tests for both. 2017-09-22 14:24:31 -07:00
Gareth J. Greenaway
ed742bb506 Updating mock from salt.utils to salt.utils.files for fopen. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
bf1aefa47b Updating memusage, ps and diskusage beacons for python3 related failures. Updating respective tests as well. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
fe5dd1e7b9 Removing unused import from ps beacon. Fixing mock for sensehat test. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
9072edd8a1 Fixing mocking for ps beacon. Types for sensehat beacon. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
d8ac1f8cfb Updating unit and integration tests for beacons to reflect changes. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
ff6f42405f Fixing typo in service beacon. Removing unused import. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
4e1fea1433 Updating logging, shuffling some imports of salt.ext.six.moves around to fix linting. better way to determine the twilio library version. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
813445d1ed Updating with various requested changes 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
cca7c0d091 Removing the wrong import, re-adding Mock and removing the ones that are not used. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
71963cccce fixing more lint issues 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
1ec4ccba85 Renaming all tests to be consistent with naming. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
7f89fa4886 Removing test_network_settings_match from tests. 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
ee3befbed8 Updating documentation for wtmp, btmp, fixing service tests and updating various bits in the service beacon. 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
6f9412b41c adding network_info, network_settings, and service tests. 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
4f6c04cbbf Adding the tests 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
507071e9e6 Updating the salt_proxy beacon to use list based configuration and adding unit tests. 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
a04b0fe3ee Updating network_info beacon for list based configuration. Adding unit tests for network_info beacon 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
7361672339 Updating the telegram_bot_msg beacon to use list based configuration rather that dictionary based configuration. 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
dfc27c63fd Updating beacon.log to use list based configuration rather than dictionary. Adding the unit test for beacon.log. 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
b03f840aed Simplying the validate functions by converting from list to dict when looking for various items to be present. 2017-08-14 12:04:36 -07:00
Gareth J. Greenaway
2a02d1c324 Updating inotify beacon & inotify beacon test to use list based configuration rather than dictionary based configuration 2017-08-14 12:04:36 -07:00
Gareth J. Greenaway
8f0a34e035 Adding unit test for haproxy beacon. Updating haproxy beacon to use list based configuration instead of dictionary based configurations 2017-08-14 12:04:36 -07:00
Gareth J. Greenaway
ebcdbfeb52 Shuffling things around in the haproxy module. Initially adding the unit test. 2017-08-14 12:04:36 -07:00
Gareth J. Greenaway
f3843ac789 Fixing validate in adb to check that the states parameter is an array/list. Updating glxinfo and glxinfo beacon tests to use configuration based on a list rather than a dictionary. 2017-08-14 12:04:36 -07:00
Gareth J. Greenaway
0b0ada65e3 Couple typos in the avahi and bonnjour beacons. Reworked the diskusage beacon to handle regex properly. Adding unit test for diskusage beacon. 2017-08-14 12:04:36 -07:00
Gareth J. Greenaway
cf1a4ff2d6 Fixing some typos in adb beacon, updating unit tests to reflect changes 2017-08-14 12:04:36 -07: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
ccf790a83f Update all references for moved functions to use "files" util
- fopen
- flopen
- fpopen
- safe_rm
- is_empty
- is_fcntl_available
2017-07-18 10:31:01 -06:00
Daniel Wallace
f309bae8b4 Make sure runtests_engine is ASCII text
If this is has any unicode characters in it, it won't load on systems that do
not default to a unicode locale.

find . -type f | while read line; do ret=$(file $line); if [[ $ret == *UTF-8* && $line == *.py ]]; then echo $line; fi; done

The above will list all files that have unicode characters in it and won't load
with locale set to C or POSIX
2017-06-05 17:30:28 -06:00
Pedro Algarvio
abe608d739
Drop @patch usage 2017-04-28 13:36:42 +01:00
Pedro Algarvio
61003bca0a
Take care of resource leakage on tests 2017-04-04 18:58:20 +01:00
Pedro Algarvio
a0245b049f
Proper mocking. 2017-04-01 14:22:59 +01:00
Pedro Algarvio
83db7547e7
Proper mocking. 2017-04-01 14:22:55 +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
Mike Place
51fb191157 Merge pull request #39841 from rafaelcaricio/telegram-beacon
Telegram beacon
2017-03-14 13:30:37 -06:00
Pedro Algarvio
7e58bde7d0
We need to compare lists under Python3 not dict_keys vs list 2017-03-14 02:17:30 +00:00
Pedro Algarvio
8f5fc49fcc
Add test case for the status beacon. Refs #38121
Tests proper handling of both the old configuration format and the new one
2017-03-09 19:33:13 +00:00
Pedro Algarvio
d56d6059f0
Remove *args, **kwargs. Not needed, not useful. 2017-03-09 19:31:14 +00:00
Pedro Algarvio
17c9490a45
These tests aren't even using mock! 2017-03-09 19:31:14 +00:00
Pedro Algarvio
38ceeb6f19
These tests are not destructive 2017-03-09 19:31:13 +00:00
Rafael Caricio
c5a7b68aac
Use new test libs 2017-03-07 11:40:10 +01:00