1
0

test_install.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # -*- coding: utf-8 -*-
  2. '''
  3. Tests for the spm install utility
  4. '''
  5. # Import python libs
  6. from __future__ import absolute_import, print_function, unicode_literals
  7. import os
  8. import shutil
  9. # Import Salt Testing libs
  10. from tests.support.case import SPMCase
  11. from tests.support.helpers import destructiveTest
  12. @destructiveTest
  13. class SPMInstallTest(SPMCase):
  14. '''
  15. Validate the spm install command
  16. '''
  17. def setUp(self):
  18. self.config = self._spm_config()
  19. self._spm_build_files(self.config)
  20. def test_spm_install_local_dir(self):
  21. '''
  22. test spm install from local directory
  23. '''
  24. build_spm = self.run_spm('build', self.config, self.formula_dir)
  25. spm_file = os.path.join(self.config['spm_build_dir'],
  26. 'apache-201506-2.spm')
  27. install = self.run_spm('install', self.config, spm_file)
  28. sls = os.path.join(self.config['formula_path'], 'apache', 'apache.sls')
  29. self.assertTrue(os.path.exists(sls))
  30. def test_spm_install_from_repo(self):
  31. '''
  32. test spm install from repo
  33. '''
  34. self._spm_create_update_repo(self.config)
  35. install = self.run_spm('install', self.config, 'apache')
  36. sls = os.path.join(self.config['formula_path'], 'apache', 'apache.sls')
  37. self.assertTrue(os.path.exists(sls))
  38. def tearDown(self):
  39. shutil.rmtree(self._tmp_spm)