This repository has been archived on 2019-08-27. You can view files and clone it, but cannot push or open issues or pull requests.
git/repo_pull_test.go

25 lines
631 B
Go

// Copyright 2018 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package git
import (
"io/ioutil"
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetFormatPatch(t *testing.T) {
repo, err := OpenRepository(".")
assert.NoError(t, err)
rd, err := repo.GetFormatPatch("cdb43f0e^", "cdb43f0e")
assert.NoError(t, err)
patchb, err := ioutil.ReadAll(rd)
assert.NoError(t, err)
patch := string(patchb)
assert.Regexp(t, "^From cdb43f0e", patch)
assert.Regexp(t, "Subject: .PATCH. add @daviian as maintainer", patch)
}