~thomir-deactivatedaccount/autopilot/trunk-make-click-call-more-pedantic

« back to all changes in this revision

Viewing changes to autopilot/tests/unit/test_platform.py

  • Committer: Thomi Richards
  • Date: 2014-02-26 19:13:39 UTC
  • mfrom: (406.2.39 autopilot)
  • Revision ID: thomi.richards@canonical.com-20140226191339-689x4coi2bchzhy4
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
144
144
                observed = platform._get_property_file().read()
145
145
        self.assertEqual(token, observed)
146
146
 
 
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")
 
153
 
 
154
        detector = platform._PlatformDetector.create()
 
155
        self.assertThat(detector.is_tablet, Equals(True))
 
156
 
 
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")
 
163
 
 
164
        detector = platform._PlatformDetector.create()
 
165
        self.assertThat(detector.is_tablet, Equals(False))
 
166
 
 
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
 
170
        file.
 
171
 
 
172
        """
 
173
        mock_get_property_file.return_value = None
 
174
 
 
175
        detector = platform._PlatformDetector.create()
 
176
        self.assertThat(detector.is_tablet, Equals(False))
 
177
 
147
178
 
148
179
class BuildPropertyParserTests(TestCase):
149
180
    """Tests for the android build properties file parser."""