Mike Place
be93710fee
Merge pull request #37452 from rallytime/fix-31135
...
file.line with mode=replace on an empty file should return False, not stacktrace
2016-11-06 14:55:11 +13:00
Erik Johnson
a3f38e5a9f
Update file.extract_hash unit tests
...
These tests now not only test the new functionality added for matching
on source URI and source_hash_name, but also test non-specific hash_type
lookups, specific hash_type lookups, and failed specific hash_type
lookups (i.e. requesting a hash type not present in the file).
2016-11-04 11:25:54 -05:00
rallytime
94a00c66eb
Write a unit test demonstrating stack trace in #31135
...
Here is the stack trace that happens when running file.line with
mode=replace on a file that exists, but is empty, as described in
the bug report:
unit.modules.file_test.FileModuleTestCase.test_replace_line_in_empty_file .................................................
Traceback (most recent call last):
File "/root/SaltStack/salt/tests/unit/modules/file_test.py", line 593, in test_replace_line_in_empty_file
mode='replace'))
File "/root/SaltStack/salt/salt/modules/file.py", line 1523, in line
for line in body.split(os.linesep)])
TypeError: expected a character buffer object
2016-11-03 14:57:10 -06:00
rallytime
180c03ca24
Merge branch '2015.8' into '2016.3'
...
Conflicts:
- salt/cli/salt.py
- salt/modules/zypper.py
- salt/scripts.py
- salt/states/boto_elb.py
- tests/integration/states/user.py
- tests/unit/states/file_test.py
2016-05-06 09:20:05 -06:00
Megan Wilhite
2c6326f14a
fix tests for file.blockplace to remove newline ( #33082 )
2016-05-06 08:44:20 -06:00
rallytime
a110b4d55d
Don't overwrite previously mocked grains
2016-03-18 13:29:08 -06:00
rallytime
fa4650523e
Pylint fixes
2016-03-18 12:21:09 -06:00
rallytime
6360ecd3b3
Merge branch '2015.8' into '2016.3'
...
Conflicts:
- salt/cloud/clouds/scaleway.py
- salt/config/__init__.py
- salt/log/mixins.py
- salt/minion.py
- salt/modules/ps.py
- salt/utils/decorators/__init__.py
- salt/utils/schema.py
- tests/unit/modules/etcd_mod_test.py
- tests/unit/modules/file_test.py
2016-03-18 11:26:12 -06:00
Christophe Drevet-Droguet
dcd6f5a5a9
test for file.apply_template_on_contents
2016-03-11 12:44:26 +01:00
Andreas Lutro
b73ee448f0
fix command args list
2016-01-13 20:59:10 +01:00
Andreas Lutro
d8b499b7c5
Make file.patch work with directories
...
In the process, make the "hash" argument optional.
Closes #29619
2016-01-13 19:15:21 +01:00
Michael Steed
bd8538db97
py3: fix salt/modules/file.py and unit tests
...
Most of the routines in the file execution module that operate on file
contents assume that they are dealing with text files (line-oriented
operations, regular expressions, etc). The exceptions are get_sum(),
get_hash(), and check_hash(). Outside of these three routines, files are
now opened in text mode.
2015-06-08 08:49:09 -06:00
Pedro Algarvio
60f215f191
Add from __future__ import absolute_import
2015-01-30 22:25:04 +00:00
Pedro Algarvio
91af550062
Switch open()
for salt.utils.fopen()
2014-11-26 18:25:20 +00:00
Nicole Thomas
6eec78fe46
Allow numerical user/group id's without looking up their existence
2014-04-03 13:02:10 -06:00
Nicole Thomas
3f51dde820
Error checking for if numerical group or user exists
2014-04-02 13:35:58 -06:00
Nicole Thomas
2edbc465f5
Allow file state to accept numerical ids
2014-04-02 11:54:42 -06:00
Adrien "ze" Urban
68e88db671
file.replace(append_if_not_found) - test units
2014-03-12 10:44:00 +01:00
Adrien "ze" Urban
ec314d4ef6
file.blockreplace(append_if_not_empty): test for missing \n at EOF
2014-03-11 18:46:01 +01:00
Thomas S Hatch
13e0d53493
Merge pull request #10029 from kaithar/feature/fix-special-bit-perm-test
...
Better handling for special bit modes
2014-01-29 19:20:31 -08:00
Daniel Bradshaw
869f980b45
Restore MagicMock as it shouldn't cause any issues.
2014-01-29 18:46:44 +00:00
Michal Galet
7394c2fd2a
Added test for salt.modules.file.extract_hash() to verify support for simple Maven checksum file format.
2014-01-29 11:57:47 +00:00
Seth de l'Isle
30e9864d66
Removed the mock for config.manage_mode which doesn't seem to be necessary
...
for any tests to pass but was causing most of the failures for my previous
commit.
Coerced several values to string representations of octal where before they
were sometimes strings and sometimes ints.
2014-01-25 10:51:50 -05:00
Erik Johnson
fca4c80e5b
Add unit test for #9097
2013-12-07 20:54:07 -06:00
Thomas S Hatch
0dc996d573
whitespace
2013-12-06 10:50:58 -07:00
Mathieu Le Marec - Pasquet
5f46962e80
pep8 fixes
2013-12-04 00:25:50 +00:00
Pedro Algarvio
880c9b5cff
Fix PEP8 E261 - White space before inline comment
2013-11-27 12:56:35 +00:00
Pedro Algarvio
f2e3a4aebe
Fix PyLint C0322 and C0324 - Spaces around opertor and commas
2013-11-27 12:48:53 +00:00
Pedro Algarvio
0ae1a15c61
PEP8 E302 and E303 blank lines fixes.
2013-11-27 12:11:45 +00:00
Pedro Algarvio
d02a2bc224
Include the python encoding file header on tests.
2013-11-27 11:19:24 +00:00
Mathieu Le Marec - Pasquet
50c1235502
add a test for #8707
2013-11-21 12:57:51 +01:00
Henrik Holmboe
77fd1acb7f
Change assertEquals to assertEqual
...
According to
http://docs.python.org/2/library/unittest.html#deprecated-aliases
assertEquals is a deprecated alias of assertEqual.
2013-10-24 11:39:04 +02:00
regilero
3db62ebc3f
Add file.blockreplace module and state. With unit tests.
2013-10-23 16:36:59 +02:00
Luper Rouch
db8eef8f32
Fixed empty file case in modules.file.append()
...
Lines are simply inserted at the beginning of the file for empty files.
2013-10-07 16:31:42 +02:00
Luper Rouch
e5631f2671
Checking for newline at EOF in modules.file.append()
2013-10-07 16:17:25 +02:00
Seth House
a4619a9c1c
Actually run the file.replace unit tests...
2013-10-03 09:28:32 -06:00
Seth House
ea657eed48
Added unit and integration tests for the file.replace functions
2013-09-20 17:01:57 -06:00
Pedro Algarvio
9353dcafd3
Revert "salt.modules.cmdmod
renamed to salt.modules.cmd
while enforcing absolute imports."
...
This reverts commit 3fa341280b
.
2013-08-20 23:44:03 +01:00
Pedro Algarvio
3fa341280b
salt.modules.cmdmod
renamed to salt.modules.cmd
while enforcing absolute imports.
2013-08-19 13:45:56 +01:00
Pedro Algarvio
cb0922faf7
Updated some of the test cases to use a much more readable approach using salttesting.helpers.ensure_in_syspath()
.
2013-06-28 00:12:59 +01:00
Pedro Algarvio
222be7b446
Make sure every test module is runnable by __main__
.
...
* Double to single quotes
2013-06-28 00:12:56 +01:00
Chris Rebert
26209c1fc1
rm unused imports reported by pyflakes
2013-04-30 14:48:04 -07:00
Pedro Algarvio
0d5c3b5f0c
Add cmd.run_all
to __salt__
. Required for the unit test.
2013-04-22 22:26:05 +01:00
Roberto Aguilar
c0c67a7509
Added test for limit in file.sed.
2013-02-13 14:36:34 -08:00