OLD | NEW |
1 # Copyright (C) 2010 Research in Motion Ltd. All rights reserved. | 1 # Copyright (C) 2010 Research in Motion Ltd. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 for test_case in test_cases: | 119 for test_case in test_cases: |
120 expected, inputs = test_case | 120 expected, inputs = test_case |
121 | 121 |
122 def mock_raw_input(message): | 122 def mock_raw_input(message): |
123 self.assertEqual(expected[0], message) | 123 self.assertEqual(expected[0], message) |
124 return inputs[1] | 124 return inputs[1] |
125 | 125 |
126 result = User().confirm(default=inputs[0], | 126 result = User().confirm(default=inputs[0], |
127 raw_input=mock_raw_input) | 127 raw_input=mock_raw_input) |
128 self.assertEqual(expected[1], result) | 128 self.assertEqual(expected[1], result) |
129 | |
130 def test_warn_if_application_is_xcode(self): | |
131 output = OutputCapture() | |
132 user = User() | |
133 output.assert_outputs(self, user._warn_if_application_is_xcode, ["TextMa
te"]) | |
134 output.assert_outputs(self, user._warn_if_application_is_xcode, ["/Appli
cations/TextMate.app"]) | |
135 output.assert_outputs(self, user._warn_if_application_is_xcode, ["XCode"
]) # case sensitive matching | |
136 | |
137 xcode_warning = "Instead of using Xcode.app, consider using EDITOR=\"xed
--wait\".\n" | |
138 output.assert_outputs(self, user._warn_if_application_is_xcode, ["Xcode"
], expected_stdout=xcode_warning) | |
139 output.assert_outputs(self, user._warn_if_application_is_xcode, ["/Devel
oper/Applications/Xcode.app"], expected_stdout=xcode_warning) | |
OLD | NEW |