コード例 #1
0
ファイル: test_todo_check.py プロジェクト: Malterlib/mongo
    def test_report_all_tickets_will_return_false_if_no_ticket_is_found(self):
        file_contents = """
        line 0
        line 1
        line 2
        this is the file contents.
        """
        todos = under_test.TodoChecker()
        todos.check_file("my file", create_file_iterator(file_contents))

        self.assertFalse(todos.report_on_all_tickets())
コード例 #2
0
ファイル: test_todo_check.py プロジェクト: Malterlib/mongo
    def test_report_on_ticket_will_return_false_if_ticket_is_not_found(self):
        file_contents = """
        line 0
        line 1
        line 2
        /* TODO server-1234 this needs some updating */
        this is the file contents.
        """
        todos = under_test.TodoChecker()
        todos.check_file("my file", create_file_iterator(file_contents))

        self.assertFalse(todos.report_on_ticket("SERVER-9876"))
コード例 #3
0
ファイル: test_todo_check.py プロジェクト: Malterlib/mongo
    def test_report_all_tickets_will_return_true_if_any_ticket_is_found(self):
        file_contents = """
        line 0
        line 1
        line 2
        /* TODO server-1234 this needs some updating */
        this is the file contents.
        /* TODO server-54321 this also needs some updating */
        """
        todos = under_test.TodoChecker()
        todos.check_file("my file", create_file_iterator(file_contents))

        self.assertTrue(todos.report_on_all_tickets())
コード例 #4
0
ファイル: test_todo_check.py プロジェクト: Malterlib/mongo
    def test_a_file_with_no_todos(self):
        file_contents = """
        line 0
        line 1
        this is the file contents.
        
        """
        todos = under_test.TodoChecker()

        todos.check_file("my file", create_file_iterator(file_contents))

        self.assertEqual(len(todos.found_todos.no_tickets), 0)
        self.assertEqual(len(todos.found_todos.with_tickets), 0)
        self.assertEqual(len(todos.found_todos.by_file), 0)
コード例 #5
0
ファイル: test_todo_check.py プロジェクト: Malterlib/mongo
    def test_commit_messages_with_no_tickets_doesnt_cause_issues(self):
        commit_message = "A random commit"
        file_contents = """
        line 0
        line 1
        line 2
        /* TODO server-1234 this needs some updating */
        this is the file contents.
        /* TODO WT-9876 this also needs some updating */
        """
        todos = under_test.TodoChecker()
        todos.check_file("my file", create_file_iterator(file_contents))

        self.assertFalse(todos.validate_commit_queue(commit_message))
コード例 #6
0
ファイル: test_todo_check.py プロジェクト: Malterlib/mongo
    def test_todos_associated_with_commit_message_should_be_found(self):
        commit_message = "SERVER-1234 making a commit"
        file_contents = """
        line 0
        line 1
        line 2
        /* TODO server-1234 this needs some updating */
        this is the file contents.
        /* TODO server-54321 this also needs some updating */
        """
        todos = under_test.TodoChecker()
        todos.check_file("my file", create_file_iterator(file_contents))

        self.assertTrue(todos.validate_commit_queue(commit_message))
コード例 #7
0
ファイル: test_todo_check.py プロジェクト: Malterlib/mongo
    def test_revert_commits_should_not_fail(self):
        commit_message = "Reverts commit SERVER-1234"
        file_contents = """
        line 0
        line 1
        line 2
        /* TODO server-1234 this needs some updating */
        this is the file contents.
        /* TODO server-54321 this also needs some updating */
        """
        todos = under_test.TodoChecker()
        todos.check_file("my file", create_file_iterator(file_contents))

        self.assertFalse(todos.validate_commit_queue(commit_message))
コード例 #8
0
ファイル: test_todo_check.py プロジェクト: Malterlib/mongo
    def test_commit_messages_with_multiple_commits_search_all_of_them(self):
        commit_message = """
        Making a wiredtiger drop
        
        WT-1234
        WT-4321
        WT-9876
        """
        file_contents = """
        line 0
        line 1
        line 2
        /* TODO server-1234 this needs some updating */
        this is the file contents.
        /* TODO WT-9876 this also needs some updating */
        """
        todos = under_test.TodoChecker()
        todos.check_file("my file", create_file_iterator(file_contents))

        self.assertTrue(todos.validate_commit_queue(commit_message))
コード例 #9
0
ファイル: test_todo_check.py プロジェクト: Malterlib/mongo
    def test_a_file_with_an_untagged_todo(self):
        file_contents = """
        line 0
        line 1
        /* todo this needs some updating */
        this is the file contents.
        """
        todos = under_test.TodoChecker()

        todos.check_file("my file", create_file_iterator(file_contents))

        self.assertEqual(len(todos.found_todos.no_tickets), 1)
        self.assertEqual(len(todos.found_todos.with_tickets), 0)
        self.assertEqual(len(todos.found_todos.by_file), 1)

        todo = todos.found_todos.no_tickets[0]
        self.assertEqual(todo.file_name, "my file")
        self.assertEqual(todo.line_number, 3)
        self.assertEqual(todo.ticket, None)

        self.assertEqual(todo, todos.found_todos.by_file["my file"][0])
コード例 #10
0
ファイル: test_todo_check.py プロジェクト: Malterlib/mongo
    def test_todo_checker_starts_out_empty(self):
        todos = under_test.TodoChecker()

        self.assertEqual(len(todos.found_todos.no_tickets), 0)
        self.assertEqual(len(todos.found_todos.with_tickets), 0)
        self.assertEqual(len(todos.found_todos.by_file), 0)