func TestCIReport(t *testing.T) {

	latestReport := GetLatestCIReport([]repository.Note{
		repository.Note(testCINote1),
		repository.Note(testCINote2),
	})

	expected, ok := Parse(repository.Note(testCINote2))
	if ok != nil {
	}
	if latestReport != expected {
		t.Errorf("This is not the latest %v ", latestReport)
	}

	latestReport = GetLatestCIReport([]repository.Note{
		repository.Note(testCINote1),
		repository.Note(testCINote2),
		repository.Note(testCINote3),
		repository.Note(testCINote4),
	})

	expected, ok = Parse(repository.Note(testCINote4))
	if ok != nil {
	}
	if latestReport != expected {
		t.Errorf("This is not the latest %v ", latestReport)
	}

}
func TestMirrorRepo(t *testing.T) {
	repo := mockRepo{
		Notes: map[repository.Revision][]repository.Note{
			repository.Revision(testRevision): []repository.Note{
				repository.Note(testReviewNote),
			},
		},
	}
	tool := mockReviewTool{make(map[repository.Revision]request.Request)}
	syncToRemote := true
	mirrorRepoToReview(repo, &tool, syncToRemote)
	if len(tool.Requests) != 1 || !validateExpectedRequest(expectedRequest, tool.Requests[testRevision]) {
		t.Errorf("Review requests are not what we expected: %v", tool.Requests)
	}
}
// Write writes a review comment as a JSON-formatted git note.
func (comment Comment) Write() (repository.Note, error) {
	bytes, err := comment.serialize()
	return repository.Note(bytes), err
}
// Write writes a review request as a JSON-formatted git note.
func (request *Request) Write() (repository.Note, error) {
	bytes, err := json.Marshal(request)
	return repository.Note(bytes), err
}