diff --git a/modules/validation/validatable_test.go b/modules/validation/validatable_test.go index 19bda27173..fdc21f3223 100644 --- a/modules/validation/validatable_test.go +++ b/modules/validation/validatable_test.go @@ -16,9 +16,8 @@ type Sut struct { func (sut Sut) Validate() []string { if sut.valid { return []string{} - } else { - return []string{"invalid"} } + return []string{"invalid"} } func Test_IsValid(t *testing.T) { diff --git a/tests/integration/api_activitypub_repository_test.go b/tests/integration/api_activitypub_repository_test.go index 60d7e32822..19bf1cf094 100644 --- a/tests/integration/api_activitypub_repository_test.go +++ b/tests/integration/api_activitypub_repository_test.go @@ -11,9 +11,9 @@ import ( "testing" "code.gitea.io/gitea/models/db" - forgefed_model "code.gitea.io/gitea/models/forgefed" "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/activitypub" + forgefed_modules "code.gitea.io/gitea/modules/forgefed" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/routers" @@ -35,7 +35,7 @@ func TestActivityPubRepository(t *testing.T) { body := resp.Body.Bytes() assert.Contains(t, string(body), "@context") - var repository forgefed_model.Repository + var repository forgefed_modules.Repository err := repository.UnmarshalJSON(body) assert.NoError(t, err) @@ -81,12 +81,12 @@ func TestActivityPubRepositoryInboxValid(t *testing.T) { repositoryID := 2 c, err := activitypub.NewClient(db.DefaultContext, actionsUser, "not used") assert.NoError(t, err) - repoInboxUrl := fmt.Sprintf("%s/api/v1/activitypub/repository-id/%v/inbox", + repoInboxURL := fmt.Sprintf("%s/api/v1/activitypub/repository-id/%v/inbox", srv.URL, repositoryID) activity := []byte(fmt.Sprintf(`{"type":"Like","startTime":"2024-03-27T00:00:00Z","actor":"%s/api/v1/activitypub/user-id/2","object":"%s/api/v1/activitypub/repository-id/%v"}`, srv.URL, srv.URL, repositoryID)) - resp, err := c.Post(activity, repoInboxUrl) + resp, err := c.Post(activity, repoInboxURL) assert.NoError(t, err) assert.Equal(t, http.StatusNoContent, resp.StatusCode) }) @@ -114,11 +114,11 @@ func TestActivityPubRepositoryInboxInvalid(t *testing.T) { repositoryID := 2 c, err := activitypub.NewClient(db.DefaultContext, actionsUser, "not used") assert.NoError(t, err) - repoInboxUrl := fmt.Sprintf("%s/api/v1/activitypub/repository-id/%v/inbox", + repoInboxURL := fmt.Sprintf("%s/api/v1/activitypub/repository-id/%v/inbox", srv.URL, repositoryID) - activity := []byte(fmt.Sprintf(`{"type":"Wrong"}`)) - resp, err := c.Post(activity, repoInboxUrl) + activity := []byte(`{"type":"Wrong"}`) + resp, err := c.Post(activity, repoInboxURL) assert.NoError(t, err) assert.Equal(t, http.StatusNotAcceptable, resp.StatusCode) })