Commit Graph

489 Commits

Author SHA1 Message Date
Erik Johnson
a9d1c12481 Add unit test for salt.utils.which
This is a Linux-only test, it will need some mock love to make it
suitable to test for windows paths.
2013-10-27 16:53:39 +00:00
Henrik Holmboe
c0aecc7c4b Use ElementTree from salt.utils._compat
Also remove duplicate import of ElementTree.
2013-10-26 18:46:17 +02:00
Xavier Barbosa
a5575aca13 deprecated assertEquals 2013-10-25 02:33:17 +02:00
Xavier Barbosa
a218aea003 fix jinja unittest 2013-10-25 02:33:16 +02:00
Xavier Barbosa
1309ef9887 fix jinja rendering of nested structures 2013-10-25 02:33:16 +02: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
Thomas S Hatch
ca77c58b41 Merge pull request #7942 from kretz/rbenv-support-in-gem
Support gem execution with rbenv ruby.
2013-10-18 09:59:55 -07:00
Martin Kretz
2e1db23b15 Added testcases to suppor rbevn in gem. 2013-10-18 13:44:45 +02:00
Thomas S Hatch
fef1647e97 Merge pull request #7889 from holmboe/virt-tmpl-refactor
Templating refactor in virt.py
2013-10-17 11:09:34 -07:00
Pedro Algarvio
9181ac81b9 Update the alternatives mocked unit tests to the new python_shell argument to cmd. 2013-10-16 23:43:27 +01:00
Pedro Algarvio
badf339b01 Improve code readability. 2013-10-16 21:51:51 +01:00
Henrik Holmboe
aa1bfc8947 Use same unit as input 2013-10-16 21:16:48 +02:00
Henrik Holmboe
f5fa6afe83 Add another unit test for disk controller 2013-10-16 21:10:59 +02:00
Henrik Holmboe
4460ed4d69 Add unit test for disk controller 2013-10-16 21:06:26 +02:00
Henrik Holmboe
fb569991b5 Add unit test for boot device 2013-10-16 20:53:37 +02:00
Seth House
bd897c0bdb Add unit test for the "python" jinja filter
Missing from c91fe1c (pull req #7866).
2013-10-16 09:24:40 -06:00
Seth House
54cc36566e Added a pprint.pformat Jinja filter to match the file.serialize state 2013-10-16 09:23:14 -06:00
Henrik Holmboe
479050b5ee Fix logic regarding telnet console and port
Provide a (temporary) default. Previously it was possible to skip
specifying telnet_port and it would result in a incomplete XML.
2013-10-16 17:20:47 +02:00
Henrik Holmboe
9add77a02a Add unit test for tcp/telnet console 2013-10-16 17:04:11 +02:00
Henrik Holmboe
e29e0408b1 Make unit tests verify the disk entries in virt._gen_xml() 2013-10-16 16:05:09 +02:00
Henrik Holmboe
4345f3a126 assertEqual gives relevant information on fail 2013-10-16 10:18:03 +02:00
Henrik Holmboe
739a644a42 Use assertEqual, less to type 2013-10-16 10:14:50 +02:00
Henrik Holmboe
4e194c2782 Whitespace. 2013-10-16 10:08:28 +02:00
Henrik Holmboe
d4164d2eb7 Add unit test for virt._gen_vol_xml() 2013-10-16 09:58:37 +02:00
Thomas S Hatch
52f2b0feb7 Merge pull request #7858 from s0undt3ch/issues/6714
Test for the presence of a yaml parsing log message. Fixes #6714.
2013-10-15 15:08:56 -07:00
Pedro Algarvio
9caffa11e7 Test for the presence of a yaml parsing log message. Fixes #6714.
Additionally, moved the yaml syntax error checking to the proper place.
2013-10-15 22:54:15 +01:00
Pedro Algarvio
1bf652541d Avoid unnecessary KeyError's while testing. 2013-10-15 22:42:21 +01:00
Pedro Algarvio
30e747060d Jinja needs to be "fed" Unicode data. Fixes #7576.
Additionally, what's returned from `render_jinja_tmpl` is also a Unicode string to that the `SLS_ENCODER` can properly encode them. Encoding UTF-8 data as UTF-8 data using the `SLS_ENCODER` does not, of course, work.
2013-10-08 00:11:44 +01:00
Pedro Algarvio
a5a87ca1fc Mimic the test case shown @ http://goo.gl/UI7uS8 2013-10-08 00:11:19 +01: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
Pedro Algarvio
3c4f33a935 Adapt remaining test cases which relied on old versioning scheme. 2013-10-04 13:10:35 +01:00
Thomas S Hatch
bb0ca15ebc Merge pull request #7187 from ajithhub/nics_as_list
Reorganize NIC Profiles as list of interfaces
2013-10-04 04:35:18 -07:00
Pedro Algarvio
1c191fb8bf Support named version strings mathematical comparison. 2013-10-04 09:53:51 +01:00
Pedro Algarvio
738902b322 Update current deprecation messages to use named versions. 2013-10-04 09:53:51 +01:00
Pedro Algarvio
f0b78cd916 Format version on deprecation messages.
Add a test case to check if a deprecation message get it's `version` format holder properly populated.
2013-10-04 09:53:51 +01:00
Pedro Algarvio
a9ceedb5eb warn_until and kwargs_warn_until are now aware of named versions.
Updated the warnings tests cases accordingly.
2013-10-04 09:53:50 +01:00
Pedro Algarvio
8c9fe2c5c1 Fix the kwargs_warn_until unit test case. 2013-10-04 09:53:50 +01:00
Pedro Algarvio
f028a004ad Fix the warnings unit test.
Since the `warn_until` function now parses and instantiates a `SaltStackVersion`, the `bugfix` part of the version info is always shown.
2013-10-04 09:53:50 +01:00
Pedro Algarvio
800c918729 Let SaltStackVersion be the original one, not a MagicMock'ed one 2013-10-04 09:53:50 +01:00
Ajith Antony
b95a5d9fd0 Virt Template deploy, and serial xml tests
- Added virt templates to setup
- moved NIC xml string template to file
- added tests for serial xml
2013-10-03 13:21:34 -05:00
Ajith Antony
c7ae3ba592 Nic profile changes
- Implement 3 styles of profile definition
- Support both config.options and config.get
- Replaces NIC substituions with template
- xml unit tests fixed up
2013-10-03 12:06:19 -05:00
Ajith Antony
6ce3973c13 added main run to simple.py 2013-10-03 11:50:49 -05:00
Seth House
a4619a9c1c Actually run the file.replace unit tests... 2013-10-03 09:28:32 -06:00
Pedro Algarvio
cf7a0b6205 Don't trigger state events on pydsl unit tests. 2013-10-03 00:59:03 +01:00
Henrik Holmboe
baf46300fa Remove unused import
We use ElementTree from salt._compat.
2013-10-02 16:17:19 +02:00
Henrik Holmboe
eea799c8c3 Specify reason for Python 2.7 requirement
While ElementTree is in Python 2.6, we need the expanded support
for xpath which was introduced in Python 2.7.

As discussed in #7264, it might be possible to install
`elementtree-1.3a3-20070912` for Python 2.6, but this is yet untested.
2013-09-30 10:40:13 +02:00
Pedro Algarvio
516e304b96 Let's try if mocking fixes the intermittent failures of the unit test. 2013-09-28 23:50:30 +01:00
Pedro Algarvio
ec07e5ae49 Adapt test cases to fixed behaviour. 2013-09-28 00:00:59 +01:00
Pedro Algarvio
9b3d504e03 Fix unit tests regarding salt.utils.find._parse_interval 2013-09-28 00:00:59 +01:00
Thomas S Hatch
bd846ffdbb Merge pull request #7264 from holmboe/esxi-init
Introduce disk profiles and enable virt.init on an ESX host
2013-09-27 08:02:11 -07:00
Henrik Holmboe
3149499765 Add unit tests
In addition to custom ESX profile, test:

 - default KVM profile
 - default ESX profile
 - custom KVM profile
2013-09-27 01:39:07 +02:00
Henrik Holmboe
7ec34af486 Refactor profile loading to use YAML
This is done in order to more easily test configuration syntax errors,
as the the minion configuration file uses YAML.
2013-09-27 01:11:28 +02:00
Henrik Holmboe
008a1b7fc9 Compatibility import for ElementTree 2013-09-27 00:58:17 +02:00
Henrik Holmboe
a8d258cefc Use StringIO from salt._compat 2013-09-27 00:45:27 +02:00
Henrik Holmboe
da3799ba19 Add unit tests for a few functions in modules.virt
For:

 * modules.virt._disk_profile()
 * modules.virt._nic_profile()
 * modules.virt._gen_xml()
2013-09-26 17:21:37 +02:00
Pedro Algarvio
a9d5ac5a3e Add unit tests to salt.utils.format_call(). 2013-09-24 22:08:08 +01:00
Pedro Algarvio
7ae519c34e Fix unit.states.rvm_test.TestRvmState.test_installed 2013-09-21 10:42:34 +01:00
Seth House
ea657eed48 Added unit and integration tests for the file.replace functions 2013-09-20 17:01:57 -06:00
Thomas S Hatch
1b261571ce Merge pull request #7338 from rca/template_error_context
Template error context
2013-09-19 13:09:04 -07:00
Pedro Algarvio
f75c59ecbf Properly handle shell unit tests which check versions. 2013-09-19 18:50:51 +01:00
Pedro Algarvio
012b8100bb Properly handle git describe with RC's and proper version comparison. 2013-09-19 18:42:37 +01:00
Pedro Algarvio
05be7064d5 0.17.0 has been tagged. The 0.16.x requires_network is no longer necessary. 2013-09-19 11:16:37 +01:00
Roberto Aguilar
ef968e7c64 Added tests for error template context. 2013-09-19 01:02:05 -07:00
Pedro Algarvio
e18ba0758b Don't include authorship in generated documentation, the Sphinx way. 2013-09-16 17:24:00 +01:00
Thomas S Hatch
4ab8d5eba5 Merge pull request #7161 from cvrebert/kwargs_warn_until
Add kwargs_warn_until() function
2013-09-10 21:10:51 -07:00
Chris Rebert
90f257df13 add salt.utils.kwargs_warn_until() 2013-09-10 17:12:25 -07:00
Pedro Algarvio
70937172ce Adapt mocked tests to the changes in #6833 2013-09-10 11:13:16 +01:00
Pedro Algarvio
22873f63bb Add another pip installed VCS test case using git+git:// 2013-09-09 20:53:52 +01:00
Pedro Algarvio
7cdddf8bf8 Fix unit.log_test.TestLog.test_issue_2853_regex_TypeError to import the proper(renamed) logging module. 2013-08-30 19:32:39 +00:00
Pedro Algarvio
598fc60e3c Fix unit.log_test.TestLog.test_issue_2853_regex_TypeError by importing salt's logging from the proper module. 2013-08-30 19:32:39 +00:00
Pedro Algarvio
51a01ef79b Added mocked pip installation test-case for when pip's version is <=1.1 2013-08-29 10:57:50 +00:00
Pedro Algarvio
25a72358ab Skip this test until properly mocked. 2013-08-28 15:21:29 +00:00
Pedro Algarvio
57feb4a015 One more missing import 2013-08-28 15:21:29 +00:00
Pedro Algarvio
5ea856c104 Fix missing import 2013-08-28 15:21:29 +00:00
Pedro Algarvio
2b64d0482d Make sure every temp dir created on the unittests respects, integration.SYS_TMP_DIR 2013-08-27 15:31:58 +00:00
Pedro Algarvio
456360dc32 Fix test expected output plus an additional one for pip git install. 2013-08-26 17:05:47 +00:00
Pedro Algarvio
6e694791fb Allow tests to be properly skipped if mock is not installed. 2013-08-26 17:05:44 +00:00
Pedro Algarvio
5d26a9fd4b Adapted unit.states.rvm_test to use salttesting.mock 2013-08-26 13:03:08 +00:00
Pedro Algarvio
23fa44ff58 Adapted unit.states.pip_test to use salttesting.mock 2013-08-26 13:03:08 +00:00
Pedro Algarvio
8f44dec13e Adapted unit.states.gem_test to use salttesting.mock 2013-08-26 13:03:08 +00:00
Pedro Algarvio
ef29861ff3 Adapted unit.states.file_test to use salttesting.mock 2013-08-26 13:03:07 +00:00
Pedro Algarvio
2eab51a429 Adapted unit.utils.warnings_test to use salttesting.mock 2013-08-26 13:03:04 +00:00
Pedro Algarvio
296c83be1f Adapted unit.pillar_test to use salttesting.mock 2013-08-26 13:01:02 +00:00
Pedro Algarvio
91fa38aea2 Adapted unit.payload_test to use salttesting.mock 2013-08-26 13:00:10 +00:00
Pedro Algarvio
d33415c73a Adapted unit.modules.rvm_test to use salttesting.mock 2013-08-26 13:00:10 +00:00
Pedro Algarvio
220aa48e24 Adapted unit.modules.poptgres_test to use salttesting.mock 2013-08-26 13:00:10 +00:00
Pedro Algarvio
6bc17f0c1b Adapted unit.modules.pip_test to use salttesting.mock 2013-08-26 13:00:10 +00:00
Pedro Algarvio
64d20afec9 Adapted unit.modules.gem_test to use salttesting.mock 2013-08-26 13:00:10 +00:00
Pedro Algarvio
2acd67bc59 Adapted unit.modules.archive_test to use salttesting.mock 2013-08-26 13:00:07 +00:00
Pedro Algarvio
8646fcb012 Adapted unit.modules.win_status_test to use salttesting.mock 2013-08-26 12:59:15 +00:00
Pedro Algarvio
fe0d7dc048 Adapted unit.modules.alternatives_test to use salttesting.mock 2013-08-26 12:59:12 +00:00
Pedro Algarvio
371f08a959 Adapted unit.modules.virtualenv to use salttesting.mock 2013-08-26 12:58:04 +00:00
Pedro Algarvio
5075898935 No absolute imports. 2013-08-22 21:45:45 +01:00
Pedro Algarvio
52b8da5d13 Adapt to the output when installing a package from a compressed file. 2013-08-22 21:06:06 +01:00
Pedro Algarvio
c78738b87a Adapt test results to the expected output. 2013-08-22 19:02:32 +01:00
Pedro Algarvio
df8bdf8646 By forcing absolute imports, we don't have to rename the pip state module. 2013-08-22 19:02:18 +01:00
Pedro Algarvio
aea94fd6a2 Another example test case. 2013-08-22 19:02:18 +01:00
Pedro Algarvio
e70827371f Some more requirements parsing tests 2013-08-22 19:02:18 +01:00
Pedro Algarvio
58ad040872 Use pip.req for parsing package requirements. Minimal tests. 2013-08-22 19:02:17 +01:00
Pedro Algarvio
bd002f97da Revert "By enforcing absolute imports, there's no need for module name aliases."
This reverts commit a1a2b49a72.
2013-08-20 23:44:05 +01: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
a1a2b49a72 By enforcing absolute imports, there's no need for module name aliases. 2013-08-19 13:23:46 +01:00
Pedro Algarvio
0c0751e793 Adapt the test case to the changes introduced in 7e9e889 2013-08-16 20:26:48 +01:00
Pedro Algarvio
2f750ed06c Allow network related tests to be skipped if no network is available. Fixes #6710. 2013-08-16 02:02:37 +01:00
Pedro Algarvio
8856c7a039 Dam! Missing import. 2013-08-13 10:38:37 +01:00
Pedro Algarvio
9d711508f5 Skip running the test is not attached to a TTY. 2013-08-13 10:25:49 +01:00
Thomas S Hatch
4808281594 freebsd uses wheel as well 2013-08-13 01:01:10 -06:00
Pedro Algarvio
8a938c9a66 Workaround the stateconf TypeError exceptions under python 2.6
```python
Traceback (most recent call last):
  File "/testing/tests/unit/stateconf_test.py", line 117, in test_state_prefix
    ''', sls='test')
  File "/testing/tests/unit/stateconf_test.py", line 30, in render_sls
    **kws.copy()
  File "/testing/salt/renderers/stateconf.py", line 229, in render
    data = process_sls_data(sls_templ, tmplctx)
  File "/testing/salt/renderers/stateconf.py", line 114, in process_sls_data
    argline=rt_argline.strip(), **kws
  File "/testing/salt/renderers/jinja.py", line 41, in render
    tmp_data.get('data', 'Unknown render error in jinja renderer')
SaltRenderError: Traceback (most recent call last):
  File "/testing/salt/utils/templates.py", line 64, in render_tmpl
    output = render_str(tmplstr, context, tmplpath)
  File "/testing/salt/utils/templates.py", line 102, in render_jinja_tmpl
    loader = JinjaSaltCacheLoader(opts, context['env'])
  File "/testing/salt/utils/jinja.py", line 42, in __init__
    self.searchpath = opts['file_roots'][env]
TypeError: list indices must be integers, not str
```
2013-08-12 13:55:03 +01:00
Thomas S Hatch
1370e72c30 Merge pull request #6555 from flupke/pillar_order2
Add support for order clauses in pillar top files
2013-08-10 21:13:20 -07:00
Thomas S Hatch
909edec564 Skip pydsl test without tty 2013-08-10 14:04:18 -06:00
Pedro Algarvio
785188802f Temporary directories should respect integration.SYS_TMP_DIR
Also, skip if the directory was not actually created.
2013-08-10 20:10:10 +01:00
Pedro Algarvio
7b3ba67bc7 Fix the test_install_pre_argument_in_resulting_command test case.
It now checks if the `--pre` output is present in versions >= 1.4 or not in versions < 1.4
2013-08-09 12:14:56 +01:00
Luper Rouch
fafdfa1800 added support for order clauses in pillar top files
Conflicts:
	tests/unit/pillar_test.py
2013-08-07 22:57:42 +02:00
Pedro Algarvio
2b0bc7056e Under python 2.6 using {}.format()(without an index) is a ValueError. 2013-08-06 19:29:08 +01:00
Roberto Aguilar
74be66baca Added tests for file.managed contents_pillar param 2013-08-04 22:09:37 -07:00
Pedro Algarvio
d6e0b2a5a2 Added unit test for list nested OrderedDict's. Refs #6460. 2013-08-01 01:34:37 +01:00
Joseph Hall
d539e6e8ff Merge pull request #6433 from s0undt3ch/sprint/mock-salt.modules.archive
Complete the work started on the sprint for `salt.modules.archive`
2013-07-30 07:21:24 -07:00
Pedro Algarvio
fe1736bbcd Fix the mocked test for archive.unrar. 2013-07-30 06:14:13 +01:00
Pedro Algarvio
189bc4e45e Added mocked tests for salt.modules.archive.unrar() 2013-07-30 05:36:19 +01:00
Pedro Algarvio
16c4057c4f Added mocked tests for salt.modules.archive.zip(). Excludes as a list 2013-07-30 05:01:39 +01:00
Pedro Algarvio
39d0006931 Added mocked tests for salt.modules.archive.unzip(). Excludes as a list 2013-07-30 05:00:58 +01:00
Pedro Algarvio
34b22afad9 Added mocked tests for salt.modules.archive.rar() 2013-07-30 04:59:28 +01:00
Pedro Algarvio
1a7b68b1a3 Added mocked tests for salt.modules.archive.unzip() 2013-07-30 04:52:31 +01:00
Pedro Algarvio
2f2047aa47 Added mocked tests for salt.modules.archive.zip() 2013-07-30 04:22:02 +01:00
Pedro Algarvio
a7c7cca94e Test if an exception is raised if the required binary is not found. 2013-07-29 23:29:58 +01:00
Thomas S Hatch
b2e41aceeb Merge pull request #6402 from s0undt3ch/sprint/mock-salt.modules.archive
Updates and fixes to `salt.modules.archive` and `salt.utils.decorators.which`
2013-07-29 09:29:13 -07:00
Pedro Algarvio
14980b7497 Update the archive.tar mocked test to the new usage. 2013-07-29 06:57:27 +01:00
Pedro Algarvio
4855c9427c Simplify our decorator code and make it reusable. 2013-07-28 22:55:27 +01:00
Joseph Hall
d64dfdc70a Merge pull request #6395 from s0undt3ch/sprint/mock-salt.modules.alternatives
Also test for `retcode > 0`.
2013-07-28 05:18:29 -07:00
Pedro Algarvio
5d0af6268e Mocked test for salt.modules.archive.gunzip() 2013-07-28 12:51:13 +01:00
Pedro Algarvio
99b8f2f70f Mocked test for salt.modules.archive.gzip() 2013-07-28 12:50:05 +01:00
Pedro Algarvio
3d17053e3f Also test for retcode > 0. 2013-07-28 12:41:15 +01:00
Pedro Algarvio
dcdb9bf686 Mocked test for salt.modules.archive.tar() 2013-07-27 19:24:49 +01:00
Thomas S Hatch
bca8014b00 Merge pull request #6347 from s0undt3ch/sprint/mock-salt.modules.alternatives
Mocked tests for `salt.modules.alternatives`
2013-07-27 10:14:17 -07:00
Pedro Algarvio
aabf18d76a Remove un-neded import. 2013-07-27 18:11:55 +01:00
Pedro Algarvio
43b513e78f Mocked test for salt.modules.alternatives.remove() 2013-07-27 18:07:18 +01:00
Pedro Algarvio
fa811882cc Mocked test for salt.modules.alternatives.install() 2013-07-27 18:04:04 +01:00
Pedro Algarvio
6f10a44279 Mocked test for salt.modules.alternatives.check_installed() 2013-07-27 17:59:16 +01:00
Pedro Algarvio
068f0d6948 Mocked test for salt.modules.alternatives.show_current() 2013-07-27 17:56:05 +01:00
Pedro Algarvio
4b2ef2c3c8 Mocked test for salt.modules.alternatives.display() 2013-07-27 17:26:54 +01:00
Pedro Algarvio
42641c6153 Added test case to see if the usage of user and runas at the same time raises an exception. 2013-07-27 16:02:59 +01:00
Pedro Algarvio
c072fa0241 Also deprecate runas on salt.states.pip.
* Added mock tests to check if the deprecation is triggered, and to see if the deprecation is also returned to the user in a warnings key.
2013-07-27 15:58:28 +01:00
Pedro Algarvio
07e7366728 user and runas now raise an exception. "There can be only one".
* Always show the deprecation message `runas` is not `None`.
* If both `user` and `runas` are used, that's an error! Full Stop!
* If `runas` is being used and `user` is not, adapt the code and don't fail.
2013-07-27 13:34:58 +01:00
Pedro Algarvio
5ee8073979 Test the deprecated runas argument to salt.modules.pip. 2013-07-27 13:06:36 +01:00
Pedro Algarvio
a33f9d771b Alaways show triggered deprecation warnings on the unit test. 2013-07-27 13:04:59 +01:00
Thomas S Hatch
579f900be6 Merge pull request #6328 from johnnoone/load-jinja-tag
Load jinja tag
2013-07-26 09:24:26 -07:00
Xavier Barbosa
c1b6e06a0f added load tag, and revamped parsing 2013-07-26 09:30:41 +02:00