def testDimensionDefaults(self):
   catalog = fake_catalogs.FakeIosCatalog()
   mgr = catalog_manager.IosCatalogManager(catalog)
   self.assertEqual(mgr.GetDefaultModel(), 'iPen2')
   self.assertEqual(mgr.GetDefaultVersion(), '6.0')
   self.assertEqual(mgr.GetDefaultLocale(), 'ro')
   self.assertEqual(mgr.GetDefaultOrientation(), 'askew')
 def testValidateModels(self):
   catalog = fake_catalogs.FakeIosCatalog()
   mgr = catalog_manager.IosCatalogManager(catalog)
   model1 = mgr.ValidateDimensionAndValue('model', 'iPencil1')
   model2 = mgr.ValidateDimensionAndValue('model', 'iPen3')
   self.assertEqual(model1, 'iPencil1')
   self.assertEqual(model2, 'iPen3')
 def testValidateDimension_InvalidDimensionName(self):
   catalog = fake_catalogs.FakeIosCatalog()
   mgr = catalog_manager.IosCatalogManager(catalog)
   with self.assertRaises(exceptions.InvalidDimensionNameError) as ex_ctx:
     mgr.ValidateDimensionAndValue('clone', 'iPear')
   self.assertIn("'clone' is not a valid dimension",
                 six.text_type(ex_ctx.exception))
 def testValidateXcodeVersion_InvalidValue(self):
   catalog = fake_catalogs.FakeIosCatalog()
   mgr = catalog_manager.IosCatalogManager(catalog)
   with self.assertRaises(exceptions.XcodeVersionNotFoundError) as ex_ctx:
     mgr.ValidateXcodeVersion('2.71828')
   self.assertIn("'2.71828' is not a supported Xcode version",
                 six.text_type(ex_ctx.exception))
 def testValidateOrientation_InvalidValue(self):
   catalog = fake_catalogs.FakeIosCatalog()
   mgr = catalog_manager.IosCatalogManager(catalog)
   with self.assertRaises(exceptions.OrientationNotFoundError) as ex_ctx:
     mgr.ValidateDimensionAndValue('orientation', 'slanted')
   self.assertIn("'slanted' is not a valid device orientation",
                 six.text_type(ex_ctx.exception))
 def testValidateLocale_InvalidValuel(self):
   catalog = fake_catalogs.FakeIosCatalog()
   mgr = catalog_manager.IosCatalogManager(catalog)
   with self.assertRaises(exceptions.LocaleNotFoundError) as ex_ctx:
     mgr.ValidateDimensionAndValue('locale', 'mtv')
   self.assertIn("'mtv' is not a valid locale",
                 six.text_type(ex_ctx.exception))
 def testValidateVersion_InvalidValue(self):
   catalog = fake_catalogs.FakeIosCatalog()
   mgr = catalog_manager.IosCatalogManager(catalog)
   with self.assertRaises(exceptions.VersionNotFoundError) as ex_ctx:
     mgr.ValidateDimensionAndValue('version', '99')
   self.assertIn("'99' is not a valid OS version",
                 six.text_type(ex_ctx.exception))
Ejemplo n.º 8
0
 def testIosModelsList_DeprecationWarningShown(self):
     self.ExpectIosCatalogGet(fake_catalogs.FakeIosCatalog())
     self.Run(commands.IOS_MODELS_LIST)
     self.AssertOutputContains(
         """iPencil1 | iPencil 1 | 5.1,6.0 | deprecated=5.1 |""",
         normalize_space=True)
     self.AssertErrContains('Some devices are deprecated. Learn more')
 def testValidateVersionIds(self):
   catalog = fake_catalogs.FakeIosCatalog()
   mgr = catalog_manager.IosCatalogManager(catalog)
   ver1 = mgr.ValidateDimensionAndValue('version', '5.1')
   ver2 = mgr.ValidateDimensionAndValue('version', '7.2')
   self.assertEqual(ver1, '5.1')
   self.assertEqual(ver2, '7.2')
Ejemplo n.º 10
0
 def testIosModelsList_ModelsFound(self):
     self.ExpectIosCatalogGet(fake_catalogs.FakeIosCatalog())
     self.Run(commands.IOS_MODELS_LIST)
     self.AssertOutputContains("""\
     | iPen2 | iPen 2 | 5.1,6.0,7.2 | default |
     | iPen3 | iPen 3 | 6.0,7.2 | unstable |""",
                               normalize_space=True)
    def testIosVersionsDescribe_VersionNotFound(self):
        self.ExpectIosCatalogGet(fake_catalogs.FakeIosCatalog())

        with self.assertRaises(exceptions.VersionNotFoundError):
            self.Run(commands.IOS_VERSIONS_DESCRIBE + 'bad-version')

        self.AssertErrContains("'bad-version' is not a valid OS version")
    def testModelsDescribe_ModelNotFound(self):
        self.ExpectIosCatalogGet(fake_catalogs.FakeIosCatalog())

        with self.assertRaises(exceptions.ModelNotFoundError):
            self.Run(commands.IOS_MODELS_DESCRIBE + 'bad-model')

        self.AssertErrContains("'bad-model' is not a valid model")
 def testValidateModel_InvalidValue(self):
   catalog = fake_catalogs.FakeIosCatalog()
   mgr = catalog_manager.IosCatalogManager(catalog)
   with self.assertRaises(exceptions.ModelNotFoundError) as ex_ctx:
     mgr.ValidateDimensionAndValue('model', 'iPear')
   self.assertIn("'iPear' is not a valid model",
                 six.text_type(ex_ctx.exception))
    def testModelsDescribe_ModelFound(self):
        self.ExpectIosCatalogGet(fake_catalogs.FakeIosCatalog())
        self.Run(commands.IOS_MODELS_DESCRIBE + 'iPen3')

        self.AssertOutputContains('id: iPen3')
        self.AssertOutputContains('name: iPen 3')
        self.AssertOutputContains("supportedVersionIds:\n- '6.0'\n- '7.2'")
        self.AssertOutputContains('tags:\n- unstable')
    def testIosVersionsDescribe_VersionFound(self):
        self.ExpectIosCatalogGet(fake_catalogs.FakeIosCatalog())
        self.Run(commands.IOS_VERSIONS_DESCRIBE + '6.0')

        self.AssertOutputContains("id: '6.0'")
        self.AssertOutputContains('majorVersion: 6')
        self.AssertOutputContains('minorVersion: 0')
        self.AssertOutputContains('supportedXcodeVersionIds:\n- ')
        self.AssertOutputContains('tags:\n- default')
Ejemplo n.º 16
0
 def testIosVersionsList_TwoVersionsFound(self):
   self.ExpectIosCatalogGet(fake_catalogs.FakeIosCatalog())
   self.Run(commands.IOS_VERSIONS_LIST)
   self.AssertOutputContains(
       """\
       | 5.1 | 5 | 1 | old | 9.2.0 |
       | 6.0 | 6 | 0 | default | 9.2.0, 10.0.1 |
       | 7.2 | 7 | 2 | | 9.2.0, 10.0.1 |""",
       normalize_space=True)
Ejemplo n.º 17
0
def _IosArgManagerWithFakeCatalog():
    cat_mgr = catalog_manager.IosCatalogManager(fake_catalogs.FakeIosCatalog())
    return arg_manager.IosArgsManager(cat_mgr)
 def testValidateOrientation(self):
   catalog = fake_catalogs.FakeIosCatalog()
   mgr = catalog_manager.IosCatalogManager(catalog)
   o1 = mgr.ValidateDimensionAndValue('orientation', 'askew')
   self.assertEqual(o1, 'askew')
 def testValidateLocales(self):
   catalog = fake_catalogs.FakeIosCatalog()
   mgr = catalog_manager.IosCatalogManager(catalog)
   l1 = mgr.ValidateDimensionAndValue('locale', 'ro')
   self.assertEqual(l1, 'ro')