mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-25 01:39:31 +00:00
Backport #27297 by @lunny Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
42f7c2ad89
commit
755369df56
|
@ -40,8 +40,10 @@ func GetYamlFixturesAccess() (string, error) {
|
||||||
fmt.Fprintf(&b, " user_id: %d\n", a.UserID)
|
fmt.Fprintf(&b, " user_id: %d\n", a.UserID)
|
||||||
fmt.Fprintf(&b, " repo_id: %d\n", a.RepoID)
|
fmt.Fprintf(&b, " repo_id: %d\n", a.RepoID)
|
||||||
fmt.Fprintf(&b, " mode: %d\n", a.Mode)
|
fmt.Fprintf(&b, " mode: %d\n", a.Mode)
|
||||||
|
if i < len(accesses)-1 {
|
||||||
fmt.Fprintf(&b, "\n")
|
fmt.Fprintf(&b, "\n")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return b.String(), nil
|
return b.String(), nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,13 @@ func TestFixtureGeneration(t *testing.T) {
|
||||||
if !assert.NoError(t, err) {
|
if !assert.NoError(t, err) {
|
||||||
return
|
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) {
|
if !assert.NoError(t, err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data := string(util.NormalizeEOL(bytes))
|
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")
|
test(GetYamlFixturesAccess, "access")
|
||||||
|
|
Loading…
Reference in a new issue