| OLD | NEW |
| 1 # Copyright (C) 2009 Google Inc. All rights reserved. | 1 # Copyright (C) 2009 Google Inc. All rights reserved. |
| 2 # Copyright (C) 2009 Apple Inc. All rights reserved. | 2 # Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 # Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All rights reserved. | 3 # Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All rights reserved. |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | 30 |
| 31 import unittest | 31 import unittest |
| 32 | 32 |
| 33 from .detection import SCMDetector | 33 from .detection import SCMDetector |
| 34 from webkitpy.common.system.filesystem_mock import MockFileSystem | 34 from webkitpy.common.system.filesystem_mock import MockFileSystem |
| 35 from webkitpy.common.system.executive_mock import MockExecutive | 35 from webkitpy.common.system.executive_mock import MockExecutive |
| 36 from webkitpy.common.system.outputcapture import OutputCapture | 36 from webkitpy.common.system.output_capture import OutputCapture |
| 37 | 37 |
| 38 | 38 |
| 39 class SCMDetectorTest(unittest.TestCase): | 39 class SCMDetectorTest(unittest.TestCase): |
| 40 | 40 |
| 41 def test_detect_scm_system(self): | 41 def test_detect_scm_system(self): |
| 42 filesystem = MockFileSystem() | 42 filesystem = MockFileSystem() |
| 43 executive = MockExecutive(should_log=True) | 43 executive = MockExecutive(should_log=True) |
| 44 detector = SCMDetector(filesystem, executive) | 44 detector = SCMDetector(filesystem, executive) |
| 45 | 45 |
| 46 expected_logs = """\ | 46 expected_logs = """\ |
| 47 MOCK run_command: ['git', 'rev-parse', '--is-inside-work-tree'], cwd=/ | 47 MOCK run_command: ['git', 'rev-parse', '--is-inside-work-tree'], cwd=/ |
| 48 """ | 48 """ |
| 49 scm = OutputCapture().assert_outputs(self, detector.detect_scm_system, [
"/"], expected_logs=expected_logs) | 49 scm = OutputCapture().assert_outputs(self, detector.detect_scm_system, [
"/"], expected_logs=expected_logs) |
| 50 self.assertIsNone(scm) | 50 self.assertIsNone(scm) |
| 51 # FIXME: This should make a synthetic tree and test Git detection in tha
t tree. | 51 # FIXME: This should make a synthetic tree and test Git detection in tha
t tree. |
| OLD | NEW |