def test_committer_lookup(self):
        committer = Committer('Test One', '*****@*****.**', 'one')
        reviewer = Reviewer('Test Two', ['*****@*****.**', '*****@*****.**', '*****@*****.**'])
        committer_list = CommitterList(committers=[committer], reviewers=[reviewer])

        # Test valid committer and reviewer lookup
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'), committer)
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'), reviewer)
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'), reviewer)
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'), reviewer)
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'), reviewer)

        # Test valid committer and reviewer lookup
        self.assertEqual(committer_list.committer_by_name("Test One"), committer)
        self.assertEqual(committer_list.committer_by_name("Test Two"), reviewer)
        self.assertEqual(committer_list.committer_by_name("Test Three"), None)

        # Test that the first email is assumed to be the Bugzilla email address (for now)
        self.assertEqual(committer_list.committer_by_email('*****@*****.**').bugzilla_email(), '*****@*****.**')

        # Test that a known committer is not returned during reviewer lookup
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'), None)

        # Test that unknown email address fail both committer and reviewer lookup
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'), None)
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'), None)

        # Test that emails returns a list.
        self.assertEqual(committer.emails, ['*****@*****.**'])

        self.assertEqual(committer.irc_nickname, 'one')

        # Test that committers returns committers and reviewers and reviewers() just reviewers.
        self.assertEqual(committer_list.committers(), [committer, reviewer])
        self.assertEqual(committer_list.reviewers(), [reviewer])
    def test_committer_lookup(self):
        committer = Committer('Test One', '*****@*****.**', 'one')
        reviewer = Reviewer('Test Two', ['*****@*****.**', '*****@*****.**', '*****@*****.**'])
        contributor = Contributor('Test Three', ['*****@*****.**'], 'three')
        contributor_with_two_nicknames = Contributor('Other Four', ['*****@*****.**'], ['four', 'otherfour'])
        committer_list = CommitterList(committers=[committer], reviewers=[reviewer], contributors=[contributor, contributor_with_two_nicknames])

        # Test valid committer, reviewer and contributor lookup
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'), committer)
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'), reviewer)
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'), reviewer)
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'), reviewer)
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'), reviewer)
        self.assertEqual(committer_list.contributor_by_email('*****@*****.**'), contributor)

        # Test valid committer, reviewer and contributor lookup
        self.assertEqual(committer_list.committer_by_name("Test One"), committer)
        self.assertEqual(committer_list.committer_by_name("Test Two"), reviewer)
        self.assertEqual(committer_list.committer_by_name("Test Three"), None)
        self.assertEqual(committer_list.contributor_by_name("Test Three"), contributor)

        # Test that the first email is assumed to be the Bugzilla email address (for now)
        self.assertEqual(committer_list.committer_by_email('*****@*****.**').bugzilla_email(), '*****@*****.**')

        # Test that a known committer is not returned during reviewer lookup
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'), None)
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'), None)
        # and likewise that a known contributor is not returned for committer lookup.
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'), None)

        # Test that unknown email address fail both committer and reviewer lookup
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'), None)
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'), None)

        # Test that emails returns a list.
        self.assertEqual(committer.emails, ['*****@*****.**'])

        self.assertEqual(committer.irc_nicknames, ['one'])
        self.assertEqual(committer_list.contributor_by_irc_nickname('one'), committer)
        self.assertEqual(committer_list.contributor_by_irc_nickname('three'), contributor)
        self.assertEqual(committer_list.contributor_by_irc_nickname('four'), contributor_with_two_nicknames)
        self.assertEqual(committer_list.contributor_by_irc_nickname('otherfour'), contributor_with_two_nicknames)

        # Test that the lists returned are are we expect them.
        self.assertEqual(committer_list.contributors(), [contributor, contributor_with_two_nicknames, committer, reviewer])
        self.assertEqual(committer_list.committers(), [committer, reviewer])
        self.assertEqual(committer_list.reviewers(), [reviewer])

        self.assertEqual(committer_list.contributors_by_search_string('test'), [contributor, committer, reviewer])
        self.assertEqual(committer_list.contributors_by_search_string('rad'), [reviewer])
        self.assertEqual(committer_list.contributors_by_search_string('Two'), [reviewer])
示例#3
0
    def test_committer_lookup(self):
        committer = Committer('Test One', '*****@*****.**', 'one')
        reviewer = Reviewer(
            'Test Two', ['*****@*****.**', '*****@*****.**', '*****@*****.**'])
        committer_list = CommitterList(committers=[committer],
                                       reviewers=[reviewer])

        # Test valid committer and reviewer lookup
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'),
                         committer)
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'),
                         reviewer)
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'),
                         reviewer)
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'),
                         reviewer)
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'),
                         reviewer)

        # Test valid committer and reviewer lookup
        self.assertEqual(committer_list.committer_by_name("Test One"),
                         committer)
        self.assertEqual(committer_list.committer_by_name("Test Two"),
                         reviewer)
        self.assertEqual(committer_list.committer_by_name("Test Three"), None)

        # Test that the first email is assumed to be the Bugzilla email address (for now)
        self.assertEqual(
            committer_list.committer_by_email('*****@*****.**').bugzilla_email(),
            '*****@*****.**')

        # Test that a known committer is not returned during reviewer lookup
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'),
                         None)

        # Test that unknown email address fail both committer and reviewer lookup
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'),
                         None)
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'), None)

        # Test that emails returns a list.
        self.assertEqual(committer.emails, ['*****@*****.**'])

        self.assertEqual(committer.irc_nickname, 'one')

        # Test that committers returns committers and reviewers and reviewers() just reviewers.
        self.assertEqual(committer_list.committers(), [committer, reviewer])
        self.assertEqual(committer_list.reviewers(), [reviewer])
示例#4
0
    def test_committer_lookup(self):
        committer = Committer('Test One', '*****@*****.**', 'one')
        reviewer = Reviewer(
            'Test Two', ['*****@*****.**', '*****@*****.**', '*****@*****.**'])
        contributor = Contributor('Test Three', ['*****@*****.**'], 'three')
        contributor_with_two_nicknames = Contributor('Other Four',
                                                     ['*****@*****.**'],
                                                     ['four', 'otherfour'])
        committer_list = CommitterList(
            committers=[committer],
            reviewers=[reviewer],
            contributors=[contributor, contributor_with_two_nicknames])

        # Test valid committer, reviewer and contributor lookup
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'),
                         committer)
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'),
                         reviewer)
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'),
                         reviewer)
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'),
                         reviewer)
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'),
                         reviewer)
        self.assertEqual(committer_list.contributor_by_email('*****@*****.**'),
                         contributor)

        # Test valid committer, reviewer and contributor lookup
        self.assertEqual(committer_list.committer_by_name("Test One"),
                         committer)
        self.assertEqual(committer_list.committer_by_name("Test Two"),
                         reviewer)
        self.assertEqual(committer_list.committer_by_name("Test Three"), None)
        self.assertEqual(committer_list.contributor_by_name("Test Three"),
                         contributor)

        # Test that the first email is assumed to be the Bugzilla email address (for now)
        self.assertEqual(
            committer_list.committer_by_email('*****@*****.**').bugzilla_email(),
            '*****@*****.**')

        # Test that a known committer is not returned during reviewer lookup
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'),
                         None)
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'),
                         None)
        # and likewise that a known contributor is not returned for committer lookup.
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'),
                         None)

        # Test that unknown email address fail both committer and reviewer lookup
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'),
                         None)
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'), None)

        # Test that emails returns a list.
        self.assertEqual(committer.emails, ['*****@*****.**'])

        self.assertEqual(committer.irc_nicknames, ['one'])
        self.assertEqual(committer_list.contributor_by_irc_nickname('one'),
                         committer)
        self.assertEqual(committer_list.contributor_by_irc_nickname('three'),
                         contributor)
        self.assertEqual(committer_list.contributor_by_irc_nickname('four'),
                         contributor_with_two_nicknames)
        self.assertEqual(
            committer_list.contributor_by_irc_nickname('otherfour'),
            contributor_with_two_nicknames)

        # Test that the lists returned are are we expect them.
        self.assertEqual(
            committer_list.contributors(),
            [contributor, contributor_with_two_nicknames, committer, reviewer])
        self.assertEqual(committer_list.committers(), [committer, reviewer])
        self.assertEqual(committer_list.reviewers(), [reviewer])

        self.assertEqual(committer_list.contributors_by_search_string('test'),
                         [contributor, committer, reviewer])
        self.assertEqual(committer_list.contributors_by_search_string('rad'),
                         [reviewer])
        self.assertEqual(committer_list.contributors_by_search_string('Two'),
                         [reviewer])
示例#5
0
    def test_committer_lookup(self):
        account = Account("Test Zero", ["*****@*****.**", "*****@*****.**"], "zero")
        committer = Committer("Test One", "*****@*****.**", "one")
        reviewer = Reviewer("Test Two", ["*****@*****.**", "*****@*****.**", "*****@*****.**"])
        contributor = Contributor("Test Three", ["*****@*****.**"], "three")
        contributor_with_two_nicknames = Contributor(
            "Other Four", ["*****@*****.**", "*****@*****.**"], ["four", "otherfour"]
        )
        contributor_with_same_email_username = Contributor(
            "Yet Another Four", ["*****@*****.**"], ["yetanotherfour"]
        )
        committer_list = CommitterList(
            watchers=[account],
            committers=[committer],
            reviewers=[reviewer],
            contributors=[contributor, contributor_with_two_nicknames, contributor_with_same_email_username],
        )

        # Test valid committer, reviewer and contributor lookup
        self.assertEqual(committer_list.account_by_email("*****@*****.**"), account)
        self.assertEqual(committer_list.committer_by_email("*****@*****.**"), committer)
        self.assertEqual(committer_list.reviewer_by_email("*****@*****.**"), reviewer)
        self.assertEqual(committer_list.committer_by_email("*****@*****.**"), reviewer)
        self.assertEqual(committer_list.committer_by_email("*****@*****.**"), reviewer)
        self.assertEqual(committer_list.reviewer_by_email("*****@*****.**"), reviewer)
        self.assertEqual(committer_list.contributor_by_email("*****@*****.**"), contributor)

        # Test valid committer, reviewer and contributor lookup
        self.assertEqual(committer_list.committer_by_name("Test One"), committer)
        self.assertEqual(committer_list.committer_by_name("Test Two"), reviewer)
        self.assertEqual(committer_list.committer_by_name("Test Three"), None)
        self.assertEqual(committer_list.contributor_by_name("Test Three"), contributor)
        self.assertEqual(committer_list.contributor_by_name("test one"), committer)
        self.assertEqual(committer_list.contributor_by_name("test two"), reviewer)
        self.assertEqual(committer_list.contributor_by_name("test three"), contributor)

        # Test that the first email is assumed to be the Bugzilla email address (for now)
        self.assertEqual(committer_list.committer_by_email("*****@*****.**").bugzilla_email(), "*****@*****.**")

        # Test lookup by login email address
        self.assertEqual(committer_list.account_by_login("*****@*****.**"), account)
        self.assertEqual(committer_list.account_by_login("*****@*****.**"), None)
        self.assertEqual(committer_list.account_by_login("*****@*****.**"), committer)
        self.assertEqual(committer_list.account_by_login("*****@*****.**"), reviewer)
        self.assertEqual(committer_list.account_by_login("*****@*****.**"), None)
        self.assertEqual(committer_list.account_by_login("*****@*****.**"), None)

        # Test that a known committer is not returned during reviewer lookup
        self.assertEqual(committer_list.reviewer_by_email("*****@*****.**"), None)
        self.assertEqual(committer_list.reviewer_by_email("*****@*****.**"), None)
        # and likewise that a known contributor is not returned for committer lookup.
        self.assertEqual(committer_list.committer_by_email("*****@*****.**"), None)

        # Test that unknown email address fail both committer and reviewer lookup
        self.assertEqual(committer_list.committer_by_email("*****@*****.**"), None)
        self.assertEqual(committer_list.reviewer_by_email("*****@*****.**"), None)

        # Test that emails returns a list.
        self.assertEqual(committer.emails, ["*****@*****.**"])

        self.assertEqual(committer.irc_nicknames, ["one"])
        self.assertEqual(committer_list.contributor_by_irc_nickname("one"), committer)
        self.assertEqual(committer_list.contributor_by_irc_nickname("three"), contributor)
        self.assertEqual(committer_list.contributor_by_irc_nickname("four"), contributor_with_two_nicknames)
        self.assertEqual(committer_list.contributor_by_irc_nickname("otherfour"), contributor_with_two_nicknames)

        # Test that the lists returned are are we expect them.
        self.assertEqual(
            committer_list.contributors(),
            [contributor, contributor_with_two_nicknames, contributor_with_same_email_username, committer, reviewer],
        )
        self.assertEqual(committer_list.committers(), [committer, reviewer])
        self.assertEqual(committer_list.reviewers(), [reviewer])

        self.assertEqual(committer_list.contributors_by_search_string("test"), [contributor, committer, reviewer])
        self.assertEqual(committer_list.contributors_by_search_string("rad"), [reviewer])
        self.assertEqual(committer_list.contributors_by_search_string("Two"), [reviewer])
        self.assertEqual(committer_list.contributors_by_search_string("otherfour"), [contributor_with_two_nicknames])
        self.assertEqual(
            committer_list.contributors_by_search_string("*otherfour*"),
            [contributor_with_two_nicknames, contributor_with_same_email_username],
        )

        self.assertEqual(committer_list.contributors_by_email_username("one"), [committer])
        self.assertEqual(committer_list.contributors_by_email_username("four"), [])
        self.assertEqual(
            committer_list.contributors_by_email_username("otherfour"),
            [contributor_with_two_nicknames, contributor_with_same_email_username],
        )
示例#6
0
    def test_committer_lookup(self):
        account = Account('Test Zero', ['*****@*****.**', '*****@*****.**'], 'zero')
        committer = Committer('Test One', '*****@*****.**', 'one')
        reviewer = Reviewer('Test Two', ['*****@*****.**', '*****@*****.**', '*****@*****.**'])
        contributor = Contributor('Test Three', ['*****@*****.**'], 'three')
        contributor_with_two_nicknames = Contributor('Other Four', ['*****@*****.**', '*****@*****.**'], ['four', 'otherfour'])
        contributor_with_same_email_username = Contributor('Yet Another Four', ['*****@*****.**'], ['yetanotherfour'])
        committer_list = CommitterList(watchers=[account], committers=[committer], reviewers=[reviewer],
            contributors=[contributor, contributor_with_two_nicknames, contributor_with_same_email_username])

        # Test valid committer, reviewer and contributor lookup
        self.assertEqual(committer_list.account_by_email('*****@*****.**'), account)
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'), committer)
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'), reviewer)
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'), reviewer)
        self.assertEqual(committer_list.committer_by_email('*****@*****.**'), reviewer)
        self.assertEqual(committer_list.reviewer_by_email('*****@*****.**'), reviewer)
        self.assertEqual(committer_list.contributor_by_email('*****@*****.**'), contributor)

        # Test valid committer, reviewer and contributor lookup
        self.assertEqual(committer_list.committer_by_name("Test One"), committer)
        self.assertEqual(committer_list.committer_by_name("Test Two"), reviewer)
        self.assertIsNone(committer_list.committer_by_name("Test Three"))
        self.assertEqual(committer_list.contributor_by_name("Test Three"), contributor)
        self.assertEqual(committer_list.contributor_by_name("test one"), committer)
        self.assertEqual(committer_list.contributor_by_name("test two"), reviewer)
        self.assertEqual(committer_list.contributor_by_name("test three"), contributor)

        # Test that the first email is assumed to be the Bugzilla email address (for now)
        self.assertEqual(committer_list.committer_by_email('*****@*****.**').bugzilla_email(), '*****@*****.**')

        # Test lookup by login email address
        self.assertEqual(committer_list.account_by_login('*****@*****.**'), account)
        self.assertIsNone(committer_list.account_by_login('*****@*****.**'))
        self.assertEqual(committer_list.account_by_login('*****@*****.**'), committer)
        self.assertEqual(committer_list.account_by_login('*****@*****.**'), reviewer)
        self.assertIsNone(committer_list.account_by_login('*****@*****.**'))
        self.assertIsNone(committer_list.account_by_login('*****@*****.**'))

        # Test that a known committer is not returned during reviewer lookup
        self.assertIsNone(committer_list.reviewer_by_email('*****@*****.**'))
        self.assertIsNone(committer_list.reviewer_by_email('*****@*****.**'))
        # and likewise that a known contributor is not returned for committer lookup.
        self.assertIsNone(committer_list.committer_by_email('*****@*****.**'))

        # Test that unknown email address fail both committer and reviewer lookup
        self.assertIsNone(committer_list.committer_by_email('*****@*****.**'))
        self.assertIsNone(committer_list.reviewer_by_email('*****@*****.**'))

        # Test that emails returns a list.
        self.assertEqual(committer.emails, ['*****@*****.**'])

        self.assertEqual(committer.irc_nicknames, ['one'])
        self.assertEqual(committer_list.contributor_by_irc_nickname('one'), committer)
        self.assertEqual(committer_list.contributor_by_irc_nickname('three'), contributor)
        self.assertEqual(committer_list.contributor_by_irc_nickname('four'), contributor_with_two_nicknames)
        self.assertEqual(committer_list.contributor_by_irc_nickname('otherfour'), contributor_with_two_nicknames)

        # Test that the lists returned are are we expect them.
        self.assertEqual(committer_list.contributors(), [contributor, contributor_with_two_nicknames, contributor_with_same_email_username, committer, reviewer])
        self.assertEqual(committer_list.committers(), [committer, reviewer])
        self.assertEqual(committer_list.reviewers(), [reviewer])

        self.assertEqual(committer_list.contributors_by_search_string('test'), [contributor, committer, reviewer])
        self.assertEqual(committer_list.contributors_by_search_string('rad'), [reviewer])
        self.assertEqual(committer_list.contributors_by_search_string('Two'), [reviewer])
        self.assertEqual(committer_list.contributors_by_search_string('otherfour'), [contributor_with_two_nicknames])
        self.assertEqual(committer_list.contributors_by_search_string('*otherfour*'), [contributor_with_two_nicknames, contributor_with_same_email_username])

        self.assertEqual(committer_list.contributors_by_email_username("one"), [committer])
        self.assertEqual(committer_list.contributors_by_email_username("four"), [])
        self.assertEqual(committer_list.contributors_by_email_username("otherfour"), [contributor_with_two_nicknames, contributor_with_same_email_username])