Commit Graph

54 Commits

Author SHA1 Message Date
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
Rafael Caricio
be2c2fab3f
Move to new style of tests 2017-03-07 09:53:48 +01:00
Rafael Caricio
aa171a5468 Add support to Telegram Bot messages beacon 2017-03-05 16:09:47 +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
2a9d2beb02
The order is shady under Py3
/cc @cachedout @rallytime
2017-02-28 22:52:48 +00:00
Pedro Algarvio
62f55073c9
Fix test cases(no longer logging errors). 2017-02-24 00:49:33 +00:00
Pedro Algarvio
15af4c9728
Test filenames conformity. Adjust for pytest. 2017-02-23 23:19:42 +00:00
Daniel Hobley
3a3ef25b51 Fix add beacon when there are no devices
- Changed the assumption that having 0 lines means there are no devices, to actually checking there are no devices
2017-02-13 13:33:52 +01:00
Daniel Hobley
85862a2f6e Added user requirement to the glxinfo beacon 2016-01-07 15:49:32 +01:00
Daniel Hobley
9f416ef0e4 Added beacon for checking if a linux minion has a screen attached
- Added unit tests
2016-01-06 13:55:38 +01:00
Daniel Hobley
24a3a98b3c Removed global in favour of updating a dictionary 2015-11-30 20:29:53 +01:00
Daniel Hobley
2690e3c8f3 Replaced double quotes with single 2015-11-30 20:19:13 +01:00
Daniel Hobley
f482643959 Added beacon for detecting low battery on android devices 2015-11-27 14:03:05 +01:00
Daniel Hobley
e0060ac5e9 Replaced user with runas for cmd.run 2015-11-01 09:35:58 +01:00
Daniel Hobley
b6e27932c8 Added the ability to run adb as a specific user 2015-10-31 23:09:08 +01:00