test_install.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # -*- coding: utf-8 -*-
  2. """
  3. Tests for the spm install utility
  4. """
  5. from __future__ import absolute_import, print_function, unicode_literals
  6. import os
  7. import shutil
  8. import pytest
  9. from tests.support.case import SPMCase
  10. @pytest.mark.destructive_test
  11. @pytest.mark.windows_whitelisted
  12. class SPMInstallTest(SPMCase):
  13. """
  14. Validate the spm install command
  15. """
  16. def setUp(self):
  17. self.config = self._spm_config()
  18. self._spm_build_files(self.config)
  19. @pytest.mark.slow_test(seconds=5) # Test takes >1 and <=5 seconds
  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"], "apache-201506-2.spm")
  26. install = self.run_spm("install", self.config, spm_file)
  27. sls = os.path.join(self.config["formula_path"], "apache", "apache.sls")
  28. self.assertTrue(os.path.exists(sls))
  29. @pytest.mark.slow_test(seconds=5) # Test takes >1 and <=5 seconds
  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)