Erik Johnson
ed40371a06
Update timezone module tests to reflect changes in mock_open
2018-06-18 00:21:26 -05:00
Erik Johnson
fc0aa9934f
Track call_count in MockOpen
2018-06-18 00:21:26 -05:00
Erik Johnson
2598d2453a
Update snapper module tests to reflect changes in mock_open
2018-06-18 00:21:26 -05:00
Erik Johnson
51b3faa7b4
Add support for passing multiple strings for a given match in read_data
2018-06-18 00:21:26 -05:00
Erik Johnson
55487c175c
Fix mock_open call to use new multifile syntax
2018-06-18 00:21:26 -05:00
Erik Johnson
7f516ef73a
Update puppet module tests to reflect changes in mock_open
2018-06-18 00:21:26 -05:00
Erik Johnson
33a97c4ecc
Update btmp beacon tests to reflect changes in mock_open
2018-06-18 00:21:26 -05:00
Erik Johnson
bc027cfa94
Update wtmp beacon tests to reflect changes in mock_open
2018-06-18 00:21:26 -05:00
Erik Johnson
f5823252bb
Track call args/kwargs in MockFH
...
This allows for them to be verified in tests
2018-06-18 00:21:25 -05:00
Erik Johnson
335591ca90
Mock the seek function in MockFH
2018-06-18 00:21:25 -05:00
Erik Johnson
7eb4b1ae1c
Update cp.push test to reflect changes to mock_open
2018-06-18 00:21:25 -05:00
Erik Johnson
2be19cfa89
Report correct location when reading using explicit size and EOF reached
2018-06-18 00:21:25 -05:00
Erik Johnson
5ec95ba5ca
On second thought, actually implement tell()
2018-06-18 00:21:25 -05:00
Erik Johnson
19022eb9e5
Add tell mock to MockFH
2018-06-18 00:21:25 -05:00
Erik Johnson
4b5a393445
Update junos tests to reflect changes to mock_open
2018-06-18 00:21:25 -05:00
Erik Johnson
278a222b09
Update dnsutil tests to reflect changes to mock_open
2018-06-18 00:21:25 -05:00
Erik Johnson
4e67955572
Replace the rest of mock_open with a class
2018-06-18 00:21:25 -05:00
Erik Johnson
75307a47c5
Update linux_sysctl tests to reflect changes to mock_open
2018-06-18 00:21:25 -05:00
Erik Johnson
05c68fd5d9
Use explicit config file and fix remaining mac_sysctl tests
...
This updates test_persist_success to work with the new mocked filehandle
support. Additionally, it fixes incorrect invocation of
`mac_sysctl.persist()`; the `config` argument is supposed to be a file
path, not a string config text.
2018-06-18 00:21:25 -05:00
Erik Johnson
836fde9a30
Allow Python 2 to accept an exception as read_data
2018-06-18 00:21:25 -05:00
Erik Johnson
543385fd02
Add writelines_calls property
2018-06-18 00:21:25 -05:00
Erik Johnson
42fa842456
Make read funcs mocks so their calls can be tracked
...
Also add a property func as a shorthand to return all the write calls
for a given filehandle.
2018-06-18 00:21:25 -05:00
Erik Johnson
675f03c58f
Update mac_sysctl tests to reflect new mock_open behavior
2018-06-18 00:21:24 -05:00
Erik Johnson
3d2c41d395
Update file module tests to reflect new mock_open behavior
2018-06-18 00:21:24 -05:00
Erik Johnson
b9200dbc3e
add a dict containing the handles to the mock_open return object
...
This allows tests to access the MockFH objects opened during the
execution of the unit test.
2018-06-18 00:16:03 -05:00
Erik Johnson
852ba4b982
Add mocked close() function to MockFH
2018-06-18 00:16:02 -05:00
Erik Johnson
f6b46bc608
Remove unused import
2018-06-18 00:16:02 -05:00
Erik Johnson
20f60a769b
Add blank lines to appease linter
2018-06-18 00:16:02 -05:00
Erik Johnson
48d7cfa6d3
Add multifile tests for mock_open
2018-06-18 00:16:02 -05:00
Erik Johnson
1861e9b944
mock_open: rewrite multi-file support
...
The initial approach tied all opened files to the same mocked
filehandle. This new approach moves all the read functions into a class,
and then uses a separate instance of that class for each opened file.
2018-06-18 00:16:02 -05:00
Erik Johnson
5e6b539770
Use function for empty string
...
Missed this when making changes for multi-file support
2018-06-18 00:16:02 -05:00
Erik Johnson
cb2620ad2b
Update core grains tests to reflect EAFP changes
2018-06-18 00:16:02 -05:00
Erik Johnson
5d09b178d7
Separate mocked file contents per filename, not glob
...
This allows for multiple opens of a file matching the same glob.
Otherwise, subsequent opens would already be at EOF.
2018-06-18 00:16:02 -05:00
Erik Johnson
875102f538
Modify mock_open to support multiple file paths
2018-06-18 00:16:02 -05:00
Erik Johnson
096ace74df
Move lsb_release parsing into its own function
...
This makes mocking easier in the unit tests, and follows the convention
used for parsing the os-release file.
2018-06-18 00:16:02 -05:00
Erik Johnson
6a0828beed
Add unit tests for mock_open
2018-06-18 00:16:02 -05:00
Erik Johnson
8ba6cadac7
More mock_open bugfixes
...
This makes readline() a regular function and not an iterator. It also
makes the different side_effect functions all operate on the same
generator representing the file contents, and adds support for reading
an explicit amount of bytes from the file. The side effect functions can
now be run one after another and the mocked filehandle will work
properly.
2018-06-18 00:16:02 -05:00
Erik Johnson
329dea218e
Add a bunch of logging for linux os_data core grains
...
Also removed a couple isfile checks and replaced them with try/except
clauses. EAFP.
2018-06-18 00:16:02 -05:00
Erik Johnson
2c64b270df
Add timestamp to the minion's log_fmt_console
...
This makes salt-call show timestamps in stdout/stderr when run from
integration tests (e.g. in ShellCase.run_script).
2018-06-18 00:16:02 -05:00
Nicole Thomas
85ebcbd3f2
Merge pull request #48156 from garethgreenaway/48113_ensure_writing_strings_with_file_dot_line
...
[2018.3] Unicode fixes for file.line
2018-06-17 15:34:07 -04:00
Nicole Thomas
33400e72db
Merge pull request #48161 from rallytime/merge-2018.3
...
[2018.3] Merge forward from 2017.7 to 2018.3
2018-06-17 15:33:28 -04:00
rallytime
0733fa1b02
Update utils path for which function to new path
2018-06-15 16:54:16 -04:00
rallytime
398cc78224
Merge branch '2017.7' into '2018.3'
...
Conflicts:
- .kitchen.yml
- doc/topics/releases/2017.7.6.rst
- salt/modules/timezone.py
- tests/support/case.py
- tests/unit/modules/test_timezone.py
2018-06-15 16:51:45 -04:00
Nicole Thomas
9aa9a83b10
Merge pull request #48155 from max-arnold/2018.3
...
Do not fail on empty saltclass classes (fix for #48145 )
2018-06-15 16:21:27 -04:00
Gareth J. Greenaway
5a9ef0d1ae
Unless we're using py2 and Windows, ensure we're writing out a string when using file.line.
2018-06-15 11:38:31 -07:00
Nicole Thomas
df2a156338
Merge pull request #48061 from garethgreenaway/port_47049_2017_7
...
[2017.7] Porting #47049 to 2017.7.
2018-06-15 13:15:49 -04:00
Nicole Thomas
152c09cc0c
Merge pull request #48104 from twangboy/fix_test_win_status
...
Fix `unit.modules.test_win_status`
2018-06-15 13:05:33 -04:00
Nicole Thomas
5ec3cf2dd4
Merge pull request #48143 from Ch3LL/fix_long_job
...
Add timeout argument to run_salt for ShellCase
2018-06-15 13:04:56 -04:00
Nicole Thomas
8cf03110d4
Merge pull request #48147 from brejoc/2018.3-multi-version-fix
...
Fix for sorting of multi-version packages
2018-06-15 13:03:17 -04:00
Max Arnold
63ab02c648
Do not fail on empty saltclass classes declaration #48145
2018-06-15 23:49:13 +07:00