def testSetTeamFilterError(self):
        syncer = sps.Syncer('tcomm_obj', 'scomm_obj')

        # "systems" is not valid (should be "system")
        teamarg = 'build:systems'

        # Verify
        with self.OutputCapturer():
            self.assertRaises(SystemExit, sps.Syncer.SetTeamFilter, syncer,
                              teamarg)
    def testSetTeamFilterOK(self):
        syncer = sps.Syncer('tcomm_obj', 'scomm_obj')

        tests = {
            'build:system:ui': set(['build', 'system', 'ui']),
            'Build:system:UI': set(['build', 'system', 'ui']),
            'kernel': set(['kernel']),
            'KERNEL': set(['kernel']),
            None: None,
            '': None,
        }

        # Verify
        for test in tests:
            syncer.SetTeamFilter(test)
            self.assertEquals(tests[test], syncer.teams)
    def testReduceOwnerName(self):
        syncer = sps.Syncer('tcomm_obj', 'scomm_obj')

        tests = {
            'joe': 'joe',
            'Joe': 'joe',
            '*****@*****.**': 'joe',
            '*****@*****.**': 'joe',
            '*****@*****.**': 'joe.bob',
            None: None,
        }

        # Verify
        for key in tests:
            result = syncer._ReduceOwnerName(key)
            self.assertEquals(tests[key], result)
    def testReduceTeamName(self):
        syncer = sps.Syncer('tcomm_obj', 'scomm_obj')

        tests = {
            'build/bdavirro': 'build',
            'build/rtc': 'build',
            'build': 'build',
            'UI/zel': 'ui',
            'UI': 'ui',
            'Build': 'build',
            None: None,
        }

        # Verify
        for key in tests:
            result = syncer._ReduceTeamName(key)
            self.assertEquals(tests[key], result)
    def testSetOwnerFilter(self):
        syncer = sps.Syncer('tcomm_obj', 'scomm_obj')

        tests = {
            'joe:bill:bob': set(['joe', 'bill', 'bob']),
            'Joe:Bill:BOB': set(['joe', 'bill', 'bob']),
            '[email protected]:bill:bob': set(['joe', 'bill', 'bob']),
            'joe': set(['joe']),
            '*****@*****.**': set(['joe']),
            '': None,
            None: None,
        }

        # Verify
        for test in tests:
            syncer.SetOwnerFilter(test)
            self.assertEquals(tests[test], syncer.owners)