Adding the orphaned options pages to the navigation
[chromium-blink-merge.git] / chrome / common / extensions / docs / server2 / platform_util_test.py
blob95378dd119c8b87972f0b48e5104044d7659f509
1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 import unittest
8 from platform_util import (GetPlatforms,
9 GetExtensionTypes,
10 ExtractPlatformFromURL,
11 PluralToSingular,
12 PlatformToExtensionType)
15 class PlatformBundleUtilityTest(unittest.TestCase):
16 def testGetPlatforms(self):
17 self.assertEqual(('apps', 'extensions'), GetPlatforms())
19 def testGetExtensionTypes(self):
20 self.assertEqual(('platform_app', 'extension'), GetExtensionTypes())
22 def testExtractPlatformFromURL(self):
23 self.assertEqual('apps', ExtractPlatformFromURL('apps/something'))
24 self.assertEqual('apps', ExtractPlatformFromURL('apps'))
25 self.assertEqual('extensions', ExtractPlatformFromURL('extensions/a/b'))
26 self.assertTrue(ExtractPlatformFromURL('a/b') is None)
27 self.assertTrue(ExtractPlatformFromURL('app') is None)
29 def testPluralToSingular(self):
30 self.assertEqual('app', PluralToSingular('apps'))
31 self.assertEqual('extension', PluralToSingular('extensions'))
32 self.assertRaises(AssertionError, PluralToSingular, 'ab')
34 def testPlatformToExtensionType(self):
35 self.assertEqual('platform_app', PlatformToExtensionType('apps'))
36 self.assertEqual('extension', PlatformToExtensionType('extensions'))
37 self.assertRaises(AssertionError, PlatformToExtensionType, 'ab')
39 if __name__ == '__main__':
40 unittest.main()