Bug 992139 - [mozversion] Enhance mozversion to return application_display_name. r=hskupin
authorCosmin Malutan <cosmin.malutan@softvision.ro>
Wed, 23 Apr 2014 10:16:02 +0200
changeset 198238 368a6f1f7eea8b7a99a2f89b32649aec499291ac
parent 198237 80dba24cc92979858f88cffdccde906a3b6d8308
child 198239 d97882e9c503b30a66c3e842156d3a152a8adfb1
push idunknown
push userunknown
push dateunknown
reviewershskupin
bugs992139
milestone31.0a1
Bug 992139 - [mozversion] Enhance mozversion to return application_display_name. r=hskupin
testing/mozbase/mozversion/mozversion/mozversion.py
testing/mozbase/mozversion/tests/test_binary.py
--- a/testing/mozbase/mozversion/mozversion/mozversion.py
+++ b/testing/mozbase/mozversion/mozversion/mozversion.py
@@ -38,24 +38,28 @@ class Version(mozlog.LoggingMixin):
 
     def get_gecko_info(self, config_path):
         for filename, section in (('application', 'App'),
                                   ('platform', 'Build')):
             config = ConfigParser.RawConfigParser()
             config_file = os.path.join(config_path, '%s.ini' % filename)
             if os.path.exists(config_file):
                 config.read(config_file)
-                name_map = {'CodeName': 'code_name',
+                name_map = {'CodeName': 'display_name',
                             'SourceRepository': 'repository',
                             'SourceStamp': 'changeset'}
                 for key in ('BuildID', 'Name', 'CodeName', 'Version',
                             'SourceRepository', 'SourceStamp'):
                     name = name_map.get(key, key).lower()
                     self._info['%s_%s' % (filename, name)] = config.has_option(
                         section, key) and config.get(section, key) or None
+
+                if not self._info.get('application_display_name'):
+                    self._info['application_display_name'] = \
+                        self._info.get('application_name')
             else:
                 self.warn('Unable to find %s' % config_file)
 
 
 class LocalVersion(Version):
 
     def __init__(self, binary, **kwargs):
         Version.__init__(self, **kwargs)
--- a/testing/mozbase/mozversion/tests/test_binary.py
+++ b/testing/mozbase/mozversion/tests/test_binary.py
@@ -64,17 +64,17 @@ SourceRepository = PlatformSourceRepo
                           os.path.join(self.tempdir, 'invalid'))
 
     def test_missing_ini_files(self):
         v = get_version(self.binary)
         self.assertEqual(v, {})
 
     def _check_version(self, version):
         self.assertEqual(version.get('application_name'), 'AppName')
-        self.assertEqual(version.get('application_code_name'), 'AppCodeName')
+        self.assertEqual(version.get('application_display_name'), 'AppCodeName')
         self.assertEqual(version.get('application_version'), 'AppVersion')
         self.assertEqual(version.get('application_buildid'), 'AppBuildID')
         self.assertEqual(
             version.get('application_repository'), 'AppSourceRepo')
         self.assertEqual(
             version.get('application_changeset'), 'AppSourceStamp')
         self.assertIsNone(version.get('platform_name'))
         self.assertIsNone(version.get('platform_version'))