salt/tests/integration/states/test_bower.py
rallytime 3273bbdab7
Merge branch '2017.7' into '2018.3'
Conflicts:
  - doc/ref/configuration/master.rst
  - doc/ref/modules/all/index.rst
  - doc/topics/grains/index.rst
  - doc/topics/releases/2016.3.4.rst
  - doc/topics/spm/spm_formula.rst
  - doc/topics/tutorials/cron.rst
  - doc/topics/tutorials/index.rst
  - doc/topics/tutorials/stormpath.rst
  - salt/engines/slack.py
  - salt/log/handlers/fluent_mod.py
  - salt/modules/cyg.py
  - salt/modules/junos.py
  - salt/modules/namecheap_dns.py
  - salt/modules/namecheap_domains.py
  - salt/modules/namecheap_ns.py
  - salt/modules/namecheap_ssl.py
  - salt/modules/namecheap_users.py
  - salt/modules/reg.py
  - salt/modules/tomcat.py
  - salt/modules/vault.py
  - salt/modules/win_file.py
  - salt/modules/zpool.py
  - salt/output/highstate.py
  - salt/renderers/pass.py
  - salt/runners/cache.py
  - salt/states/boto_apigateway.py
  - salt/states/boto_iam.py
  - salt/states/boto_route53.py
  - salt/states/msteams.py
  - salt/states/reg.py
  - salt/states/win_iis.py
  - tests/integration/modules/test_cmdmod.py
  - tests/integration/states/test_user.py
  - tests/support/helpers.py
  - tests/unit/cloud/clouds/test_openstack.py
  - tests/unit/fileserver/test_gitfs.py
  - tests/unit/modules/test_junos.py
  - tests/unit/pillar/test_git.py
  - tests/unit/states/test_win_path.py
  - tests/unit/test_pillar.py
  - tests/unit/utils/test_format_call.py
  - tests/unit/utils/test_utils.py
  - tests/unit/utils/test_warnings.py
2018-06-01 14:54:12 -04:00

76 lines
2.8 KiB
Python

# -*- coding: utf-8 -*-
'''
:codeauthor: Alexander Pyatkin <asp@thexyz.net
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
from tests.support.helpers import destructiveTest
from tests.support.mixins import SaltReturnAssertsMixin
# Import salt libs
import salt.utils.json
import salt.utils.path
@skipIf(salt.utils.path.which('bower') is None, 'bower not installed')
class BowerStateTest(ModuleCase, SaltReturnAssertsMixin):
@destructiveTest
def test_bower_installed_removed(self):
'''
Basic test to determine if Bower package was successfully installed and
removed.
'''
ret = self.run_state('file.directory', name='/salt_test_bower_1',
makedirs=True)
self.assertSaltTrueReturn(ret)
ret = self.run_state('bower.installed', name='underscore',
dir='/salt_test_bower_1')
self.assertSaltTrueReturn(ret)
ret = self.run_state('bower.removed', name='underscore',
dir='/salt_test_bower_1')
self.assertSaltTrueReturn(ret)
ret = self.run_state('file.absent', name='/salt_test_bower_1')
self.assertSaltTrueReturn(ret)
@destructiveTest
def test_bower_installed_pkgs(self):
'''
Basic test to determine if Bower package successfully installs multiple
packages.
'''
ret = self.run_state('file.directory', name='/salt_test_bower_2',
makedirs=True)
self.assertSaltTrueReturn(ret)
ret = self.run_state('bower.installed', name='test',
dir='/salt_test_bower_2',
pkgs=['numeral', 'underscore'])
self.assertSaltTrueReturn(ret)
ret = self.run_state('file.absent', name='/salt_test_bower_2')
self.assertSaltTrueReturn(ret)
@destructiveTest
def test_bower_installed_from_file(self):
ret = self.run_state('file.directory', name='/salt_test_bower_3',
makedirs=True)
self.assertSaltTrueReturn(ret)
bower_json = salt.utils.json.dumps({
'name': 'salt_test_bower_3',
'dependencies': {
'numeral': '~1.5.3',
'underscore': '~1.7.0'
}
})
ret = self.run_state('file.managed',
name='/salt_test_bower_3/bower.json',
contents=bower_json)
self.assertSaltTrueReturn(ret)
ret = self.run_state('bower.bootstrap', name='/salt_test_bower_3')
self.assertSaltTrueReturn(ret)
ret = self.run_state('file.absent', name='/salt_test_bower_3')
self.assertSaltTrueReturn(ret)