144
144
observed = platform._get_property_file().read()
145
145
self.assertEqual(token, observed)
147
@patch('autopilot.platform._get_property_file')
148
def test_get_tablet_from_property_file(
149
self, mock_get_property_file):
150
"""Detector must read tablet from android properties file."""
151
mock_get_property_file.return_value = StringIO(
152
"ro.build.characteristics=tablet")
154
detector = platform._PlatformDetector.create()
155
self.assertThat(detector.is_tablet, Equals(True))
157
@patch('autopilot.platform._get_property_file')
158
def test_get_not_tablet_from_property_file(
159
self, mock_get_property_file):
160
"""Detector must read lack of tablet from android properties file."""
161
mock_get_property_file.return_value = StringIO(
162
"ro.build.characteristics=nosdcard")
164
detector = platform._PlatformDetector.create()
165
self.assertThat(detector.is_tablet, Equals(False))
167
@patch('autopilot.platform._get_property_file')
168
def test_tablet_without_property_file(self, mock_get_property_file):
169
"""Detector must return False for tablet when there is no properties
173
mock_get_property_file.return_value = None
175
detector = platform._PlatformDetector.create()
176
self.assertThat(detector.is_tablet, Equals(False))
148
179
class BuildPropertyParserTests(TestCase):
149
180
"""Tests for the android build properties file parser."""