mirror of
1
Fork 0

Fix yaml test (#27297)

This commit is contained in:
Lunny Xiao 2023-09-27 11:30:03 +08:00 committed by GitHub
parent c5247eff73
commit e59c9e3ecd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -40,7 +40,9 @@ func GetYamlFixturesAccess() (string, error) {
fmt.Fprintf(&b, " user_id: %d\n", a.UserID)
fmt.Fprintf(&b, " repo_id: %d\n", a.RepoID)
fmt.Fprintf(&b, " mode: %d\n", a.Mode)
fmt.Fprintf(&b, "\n")
if i < len(accesses)-1 {
fmt.Fprintf(&b, "\n")
}
}
return b.String(), nil

View File

@ -22,12 +22,13 @@ func TestFixtureGeneration(t *testing.T) {
if !assert.NoError(t, err) {
return
}
bytes, err := os.ReadFile(filepath.Join(unittest.FixturesDir(), name+".yml"))
p := filepath.Join(unittest.FixturesDir(), name+".yml")
bytes, err := os.ReadFile(p)
if !assert.NoError(t, err) {
return
}
data := string(util.NormalizeEOL(bytes))
assert.True(t, data == expected, "Differences detected for %s.yml", name)
assert.EqualValues(t, expected, data, "Differences detected for %s", p)
}
test(GetYamlFixturesAccess, "access")