From b7c7d5ab5f1263e4261a70e41af52ab483c6577c Mon Sep 17 00:00:00 2001 From: Martijn van der Kleijn Date: Sun, 16 Jun 2024 00:11:17 +0200 Subject: [PATCH] Use different avatar URL when testing in CI Signed-off-by: Martijn van der Kleijn --- forgejo/user_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/forgejo/user_test.go b/forgejo/user_test.go index 502e706..326ca63 100644 --- a/forgejo/user_test.go +++ b/forgejo/user_test.go @@ -10,6 +10,7 @@ package forgejo import ( "log" + "os" "testing" "github.com/stretchr/testify/assert" @@ -17,6 +18,14 @@ import ( func TestMyUser(t *testing.T) { log.Println("== TestMyUser ==") + + var expectedAvatarURL string + if os.Getenv("CI") == "woodpecker" { + expectedAvatarURL = "http://forgejo:3000/avatars/90e9f0102fc2832d69ae59a1214601c0" + } else { + expectedAvatarURL = "http://localhost:3000/avatars/90e9f0102fc2832d69ae59a1214601c0" + } + c := newTestClient() user, _, err := c.GetMyUserInfo() assert.NoError(t, err) @@ -25,7 +34,7 @@ func TestMyUser(t *testing.T) { assert.EqualValues(t, "test01", user.UserName) assert.EqualValues(t, "test01@forgejo.org", user.Email) assert.EqualValues(t, "", user.FullName) - assert.EqualValues(t, "http://localhost:3000/avatars/90e9f0102fc2832d69ae59a1214601c0", user.AvatarURL) + assert.EqualValues(t, expectedAvatarURL, user.AvatarURL) assert.True(t, user.IsAdmin) }