示例#1
0
 def setUp(self):
     self.flags = Flags(
         "contentaccessible=yes",
         "appversion>=3.5",
         "application=foo",
         "application=bar",
         "appversion<2.0",
         "platform",
         "abi!=Linux_x86-gcc3",
     )
示例#2
0
class TestFlags(unittest.TestCase):
    def setUp(self):
        self.flags = Flags('contentaccessible=yes',
                           'appversion>=3.5',
                           'application=foo',
                           'application=bar',
                           'appversion<2.0',
                           'platform',
                           'abi!=Linux_x86-gcc3')

    def test_flags_str(self):
        self.assertEqual(str(self.flags), 'contentaccessible=yes ' +
                         'appversion>=3.5 appversion<2.0 application=foo ' +
                         'application=bar platform abi!=Linux_x86-gcc3')

    def test_flags_match_unset(self):
        self.assertTrue(self.flags.match(os='WINNT'))

    def test_flags_match(self):
        self.assertTrue(self.flags.match(application='foo'))
        self.assertFalse(self.flags.match(application='qux'))

    def test_flags_match_different(self):
        self.assertTrue(self.flags.match(abi='WINNT_x86-MSVC'))
        self.assertFalse(self.flags.match(abi='Linux_x86-gcc3'))

    def test_flags_match_version(self):
        self.assertTrue(self.flags.match(appversion='1.0'))
        self.assertTrue(self.flags.match(appversion='1.5'))
        self.assertFalse(self.flags.match(appversion='2.0'))
        self.assertFalse(self.flags.match(appversion='3.0'))
        self.assertTrue(self.flags.match(appversion='3.5'))
        self.assertTrue(self.flags.match(appversion='3.10'))
示例#3
0
class TestFlags(unittest.TestCase):
    def setUp(self):
        self.flags = Flags('contentaccessible=yes', 'appversion>=3.5',
                           'application=foo', 'application=bar',
                           'appversion<2.0', 'platform', 'abi!=Linux_x86-gcc3')

    def test_flags_str(self):
        self.assertEqual(
            str(self.flags), 'contentaccessible=yes ' +
            'appversion>=3.5 appversion<2.0 application=foo ' +
            'application=bar platform abi!=Linux_x86-gcc3')

    def test_flags_match_unset(self):
        self.assertTrue(self.flags.match(os='WINNT'))

    def test_flags_match(self):
        self.assertTrue(self.flags.match(application='foo'))
        self.assertFalse(self.flags.match(application='qux'))

    def test_flags_match_different(self):
        self.assertTrue(self.flags.match(abi='WINNT_x86-MSVC'))
        self.assertFalse(self.flags.match(abi='Linux_x86-gcc3'))

    def test_flags_match_version(self):
        self.assertTrue(self.flags.match(appversion='1.0'))
        self.assertTrue(self.flags.match(appversion='1.5'))
        self.assertFalse(self.flags.match(appversion='2.0'))
        self.assertFalse(self.flags.match(appversion='3.0'))
        self.assertTrue(self.flags.match(appversion='3.5'))
        self.assertTrue(self.flags.match(appversion='3.10'))
示例#4
0
 def setUp(self):
     self.flags = Flags('contentaccessible=yes',
                        'appversion>=3.5',
                        'application=foo',
                        'application=bar',
                        'appversion<2.0',
                        'platform',
                        'abi!=Linux_x86-gcc3')
示例#5
0
 def __init__(self, base, *flags):
     '''
     Initialize a manifest entry with the given base path and flags.
     '''
     self.base = base
     self.flags = Flags(*flags)
     if not all(f in self.allowed_flags for f in self.flags):
         errors.fatal('%s unsupported for %s manifest entries' %
                      (','.join(f for f in self.flags
                                if not f in self.allowed_flags), self.type))
示例#6
0
 def __init__(self, base, *flags):
     """
     Initialize a manifest entry with the given base path and flags.
     """
     self.base = base
     self.flags = Flags(*flags)
     if not all(f in self.allowed_flags for f in self.flags):
         errors.fatal("%s unsupported for %s manifest entries" % (
             ",".join(f for f in self.flags if f not in self.allowed_flags),
             self.type,
         ))
示例#7
0
class TestFlags(unittest.TestCase):
    def setUp(self):
        self.flags = Flags(
            "contentaccessible=yes",
            "appversion>=3.5",
            "application=foo",
            "application=bar",
            "appversion<2.0",
            "platform",
            "abi!=Linux_x86-gcc3",
        )

    def test_flags_str(self):
        self.assertEqual(
            str(self.flags),
            "contentaccessible=yes " +
            "appversion>=3.5 appversion<2.0 application=foo " +
            "application=bar platform abi!=Linux_x86-gcc3",
        )

    def test_flags_match_unset(self):
        self.assertTrue(self.flags.match(os="WINNT"))

    def test_flags_match(self):
        self.assertTrue(self.flags.match(application="foo"))
        self.assertFalse(self.flags.match(application="qux"))

    def test_flags_match_different(self):
        self.assertTrue(self.flags.match(abi="WINNT_x86-MSVC"))
        self.assertFalse(self.flags.match(abi="Linux_x86-gcc3"))

    def test_flags_match_version(self):
        self.assertTrue(self.flags.match(appversion="1.0"))
        self.assertTrue(self.flags.match(appversion="1.5"))
        self.assertFalse(self.flags.match(appversion="2.0"))
        self.assertFalse(self.flags.match(appversion="3.0"))
        self.assertTrue(self.flags.match(appversion="3.5"))
        self.assertTrue(self.flags.match(appversion="3.10"))
示例#8
0
 def setUp(self):
     self.flags = Flags('contentaccessible=yes', 'appversion>=3.5',
                        'application=foo', 'application=bar',
                        'appversion<2.0', 'platform', 'abi!=Linux_x86-gcc3')