make start time more flexible

This commit is contained in:
Michael Jerger 2024-05-10 16:25:54 +02:00
parent c4c03dab4b
commit 0665c1252e

View file

@ -9,6 +9,7 @@ import (
"net/http/httptest" "net/http/httptest"
"net/url" "net/url"
"testing" "testing"
"time"
"code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/user" "code.gitea.io/gitea/models/user"
@ -99,11 +100,12 @@ func TestActivityPubRepositoryInboxValid(t *testing.T) {
activity := []byte(fmt.Sprintf( activity := []byte(fmt.Sprintf(
`{"type":"Like",`+ `{"type":"Like",`+
`"startTime":"2024-03-27T00:00:01Z",`+ `"startTime":"%s",`+
`"actor":"%s/api/v1/activitypub/user-id/2",`+ `"actor":"%s/api/v1/activitypub/user-id/2",`+
`"object":"%s/api/v1/activitypub/repository-id/%v"}`, `"object":"%s/api/v1/activitypub/repository-id/%v"}`,
//time.Now().Format(time.RFC3339), time.Now().UTC().Format(time.RFC3339),
srv.URL, srv.URL, repositoryID)) srv.URL, srv.URL, repositoryID))
t.Logf("activity: %s", activity)
resp, err := c.Post(activity, repoInboxURL) resp, err := c.Post(activity, repoInboxURL)
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, http.StatusNoContent, resp.StatusCode) assert.Equal(t, http.StatusNoContent, resp.StatusCode)