Header updates. More copyright to the SaltSatck team. Code author to me(where applicable).

This commit is contained in:
Pedro Algarvio 2012-12-11 10:23:37 +00:00
parent a704410cbc
commit 7c5a5d0bd3
16 changed files with 128 additions and 76 deletions

View file

@ -1,10 +1,14 @@
# -*- coding: utf-8 -*-
# vim: sw=4 ts=4 fenc=utf-8
"""
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:license: Apache 2.0, see LICENSE for more details
"""
'''
runtests_helpers.py
~~~~~~~~~~~~~~~~~~~
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
'''
# Import python libs
import os
import tempfile

View file

@ -3,18 +3,21 @@
tests.integration.modules.event
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
'''
# Import python libs
import time
import threading
from Queue import Queue, Empty
# Import salt libs
import integration
from salt.utils import event
class EventModuleTest(integration.ModuleCase):
def test_event_fire_master(self):
events = Queue()
@ -35,7 +38,9 @@ class EventModuleTest(integration.ModuleCase):
self.assertTrue(ret)
eventfired = events.get(block=True, timeout=10)
self.assertIn('event.fire_master: just test it!!!!', eventfired['data'])
self.assertIn(
'event.fire_master: just test it!!!!', eventfired['data']
)
ret = self.run_function(
'event.fire_master',

View file

@ -1,12 +1,14 @@
# -*- coding: utf-8 -*-
"""
'''
tests.integration.modules.pip
=============================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:license: Apache 2.0, see LICENSE for more details
"""
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
'''
# Import python libs
import os
import shutil
import tempfile
@ -53,11 +55,12 @@ class PipModuleTest(integration.ModuleCase):
ret = self.run_function('pip.install', ['pep8'], bin_env=self.venv_dir)
self.assertEqual(ret['retcode'], 0)
self.assertIn('installed pep8', ret['stdout'])
ret = self.run_function('pip.uninstall', ['pep8'], bin_env=self.venv_dir)
ret = self.run_function(
'pip.uninstall', ['pep8'], bin_env=self.venv_dir
)
self.assertEqual(ret['retcode'], 0)
self.assertIn('uninstalled pep8', ret['stdout'])
def tearDown(self):
super(PipModuleTest, self).tearDown()
if os.path.isdir(self.venv_test_dir):

View file

@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
"""
'''
tests.integration.shell.call
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
"""
'''
# Import python libs
import os

View file

@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
"""
'''
tests.integration.shell.cp
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
"""
'''
# Import python libs
import os

View file

@ -1,28 +1,30 @@
# -*- coding: utf-8 -*-
"""
'''
tests.integration.shell.master
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
"""
'''
# Import python libs
import sys
# Import salt libs
from saltunittest import TestLoader, TextTestRunner
import integration
from integration import TestDaemon
class MasterTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn):
_call_binary_ = 'salt-master'
if __name__ == "__main__":
loader = TestLoader()
tests = loader.loadTestsFromTestCase(MasterTest)
print('Setting up Salt daemons to execute tests')
with TestDaemon():
with integration.TestDaemon():
runner = TextTestRunner(verbosity=1).run(tests)
sys.exit(runner.wasSuccessful())
sys.exit(runner.wasSuccessful())

View file

@ -1,28 +1,30 @@
# -*- coding: utf-8 -*-
"""
'''
tests.integration.shell.minion
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
"""
'''
# Import python libs
import sys
# Import salt libs
from saltunittest import TestLoader, TextTestRunner
import integration
from integration import TestDaemon
class MinionTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn):
_call_binary_ = 'salt-minion'
if __name__ == "__main__":
loader = TestLoader()
tests = loader.loadTestsFromTestCase(MinionTest)
print('Setting up Salt daemons to execute tests')
with TestDaemon():
with integration.TestDaemon():
runner = TextTestRunner(verbosity=1).run(tests)
sys.exit(runner.wasSuccessful())
sys.exit(runner.wasSuccessful())

View file

@ -1,28 +1,30 @@
# -*- coding: utf-8 -*-
"""
'''
tests.integration.shell.syndic
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
"""
'''
# Import python libs
import sys
# Import salt libs
from saltunittest import TestLoader, TextTestRunner
import integration
from integration import TestDaemon
class SyndicTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn):
_call_binary_ = 'salt-syndic'
if __name__ == "__main__":
loader = TestLoader()
tests = loader.loadTestsFromTestCase(SyndicTest)
print('Setting up Salt daemons to execute tests')
with TestDaemon():
with integration.TestDaemon():
runner = TextTestRunner(verbosity=1).run(tests)
sys.exit(runner.wasSuccessful())
sys.exit(runner.wasSuccessful())

View file

@ -1,9 +1,12 @@
# -*- coding: utf-8 -*-
# vim: sw=4 ts=4 fenc=utf-8
"""
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:license: Apache 2.0, see LICENSE for more details
"""
'''
tests.integration.states.match
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
'''
# Import python libs
import os

View file

@ -1,7 +1,11 @@
# -*- coding: utf-8 -*-
'''
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:license: Apache 2.0, see LICENSE for more details
tests.integration.states.pip
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
'''
# Import python libs

View file

@ -1,8 +1,12 @@
# -*- coding: utf-8 -*-
"""
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:license: Apache 2.0, see LICENSE for more details
"""
'''
tests.integration.states.virtualenv
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
'''
# Import python libs
import os

View file

@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
"""
tests.unit.config
~~~~~~~~~~~~~~~~~
'''
tests.unit.config_test
~~~~~~~~~~~~~~~~~~~~~~
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
"""
'''
# Import python libs
import os

View file

@ -3,19 +3,23 @@
tests.unit.utils.event_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
'''
# Import python libs
import os
import integration
import hashlib
from saltunittest import TestCase, TestLoader, TextTestRunner
# Import salt libs
import integration
from saltunittest import TestCase, TestLoader, TextTestRunner
from salt.utils import event
SOCK_DIR = os.path.join(integration.TMP, 'test-socks')
class TestSaltEvent(TestCase):
def test_master_event(self):
@ -40,13 +44,17 @@ class TestSaltEvent(TestCase):
self.assertEqual(
me.puburi,
'ipc://{0}'.format(
os.path.join(SOCK_DIR, 'minion_event_{0}_pub.ipc'.format(id_hash))
os.path.join(
SOCK_DIR, 'minion_event_{0}_pub.ipc'.format(id_hash)
)
)
)
self.assertEqual(
me.pulluri,
'ipc://{0}'.format(
os.path.join(SOCK_DIR, 'minion_event_{0}_pull.ipc'.format(id_hash))
os.path.join(
SOCK_DIR, 'minion_event_{0}_pull.ipc'.format(id_hash)
)
)
)
@ -62,18 +70,21 @@ class TestSaltEvent(TestCase):
self.assertEqual(
me.puburi,
'ipc://{0}'.format(
os.path.join(SOCK_DIR, 'minion_event_{0}_pub.ipc'.format(id_hash))
os.path.join(
SOCK_DIR, 'minion_event_{0}_pub.ipc'.format(id_hash)
)
)
)
self.assertEqual(
me.pulluri,
'ipc://{0}'.format(
os.path.join(SOCK_DIR, 'minion_event_{0}_pull.ipc'.format(id_hash))
os.path.join(
SOCK_DIR, 'minion_event_{0}_pull.ipc'.format(id_hash)
)
)
)
if __name__ == "__main__":
loader = TestLoader()
tests = loader.loadTestsFromTestCase(TestSaltEvent)

View file

@ -3,15 +3,16 @@
tests.unit.utils.filebuffer_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
'''
# Import salt libs
from saltunittest import TestCase, TestLoader, TextTestRunner
from salt.utils.filebuffer import BufferedReader, InvalidFileMode
class TestFileBuffer(TestCase):
def test_read_only_mode(self):
with self.assertRaises(InvalidFileMode):
@ -26,6 +27,7 @@ class TestFileBuffer(TestCase):
with self.assertRaises(InvalidFileMode):
BufferedReader('/tmp/foo', mode='wb')
if __name__ == "__main__":
loader = TestLoader()
tests = loader.loadTestsFromTestCase(TestFileBuffer)

View file

@ -1,12 +1,14 @@
# -*- coding: utf-8 -*-
"""
'''
tests.unit.utils.path_join_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
"""
'''
# Import python libs
import os
import sys
import posixpath
@ -19,6 +21,7 @@ if __name__ == "__main__":
0, os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
)
# Import salt libs
from saltunittest import TestCase, TextTestRunner
from salt.utils import path_join

View file

@ -1,17 +1,21 @@
# -*- coding: utf-8 -*-
"""
tests.unit.utils.runtime_whitespace_regex
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'''
tests.unit.utils.runtime_whitespace_regex_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: © 2012 UfSoft.org - :email:`Pedro Algarvio (pedro@algarvio.me)`
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2012 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
"""
'''
# Import python libs
import re
from saltunittest import TestCase, TestLoader, TextTestRunner
# Import salt libs
from saltunittest import TestCase, TestLoader, TextTestRunner
from salt.utils import build_whitepace_splited_regex
DOUBLE_TXT = """\
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then