Exemplo n.º 1
0
    def test_filter_author(self):
        dummy_model = QGitModel(self.TEST_dir)
        dummy_model.set_current_branch(self.TEST_wallace_branch)
        dummy_model.populate()
        author = "Wallace"
        author_email = "-wallace"

        error = "On the wallace branch model, wrong author_name filter score for %d:%d"
        error_email = "On the wallace branch model, wrong author_email filter score for %d:%d"
        author_name_column = dummy_model.get_columns().index('author_name')
        author_email_column = dummy_model.get_columns().index('author_email')
        for row, commit in enumerate(self.TEST_wallace_branch_commits):
            dummy_model.filter_set("nameEmail", QRegExp(author))
            index = dummy_model.createIndex(row, author_name_column)
            score = dummy_model.filter_score(index)

            dummy_model.filter_set("nameEmail", QRegExp(author_email))
            index_email = dummy_model.createIndex(row, author_email_column)
            score_email = dummy_model.filter_score(index_email)

            if row != dummy_model.rowCount() - 1:
                self.check(score, 1, error % (row, author_name_column))
                self.check(score_email, 1,
                           error_email % (row, author_email_column))
            else:
                self.check(score, 0, error % (row, author_name_column))
                self.check(score_email, 0,
                           error_email % (row, author_email_column))
Exemplo n.º 2
0
    def test_filter_message(self):
        dummy_model = QGitModel(self.TEST_dir)
        dummy_model.set_current_branch(self.TEST_master_branch)
        dummy_model.populate()
        message = "rodney"
        dummy_model.filter_set("message", QRegExp(message))

        error = "On the master branch model, wrong message filter score for %d:%d"
        message_column = dummy_model.get_columns().index('message')
        for row, commit in enumerate(self.TEST_master_branch_commits):
            index = dummy_model.createIndex(row, message_column)
            score = dummy_model.filter_score(index)

            if message in commit[1]:
                self.check(score, 1, error % (row, message_column))
            else:
                self.check(score, 0, error % (row, message_column))