You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.3 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2017 LasLabs Inc.
  3. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
  4. import os
  5. from .common import Common
  6. class TestExternalSystemOs(Common):
  7. @classmethod
  8. def setUpClass(cls):
  9. """Remember the working dir, just in case."""
  10. super(TestExternalSystemOs, cls).setUpClass()
  11. cls.working_dir = os.getcwd()
  12. @classmethod
  13. def tearDownClass(cls):
  14. """Set the working dir back to origin, just in case."""
  15. super(TestExternalSystemOs, cls).tearDownClass()
  16. os.chdir(cls.working_dir)
  17. def setUp(self):
  18. super(TestExternalSystemOs, self).setUp()
  19. self.record = self.env.ref('base_external_system.external_system_os')
  20. def test_external_get_client_returns_os(self):
  21. """It should return the Pyhton OS module."""
  22. self.assertEqual(self.record.external_get_client(), os)
  23. def test_external_get_client_changes_directories(self):
  24. """It should change to the proper directory."""
  25. self.record.external_get_client()
  26. self.assertEqual(os.getcwd(), self.record.remote_path)
  27. def test_external_destroy_client_changes_directory(self):
  28. """It should change back to the previous working directory."""
  29. self.record.external_destroy_client(None)
  30. self.assertEqual(os.getcwd(), self.working_dir)