mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-22 13:45:19 +00:00
Fix tests
This commit is contained in:
parent
68cd621053
commit
02dc8901af
|
@ -29,10 +29,10 @@ var mockStar *forgefed.Star = &forgefed.Star{
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestActorParserEmpty(t *testing.T) {
|
func TestActorParserEmpty(t *testing.T) {
|
||||||
item := emptyMockStar
|
item := ""
|
||||||
want := ActorID{}
|
want := ActorID{}
|
||||||
|
|
||||||
got, _ := ParseActorIDFromStarActivity(item)
|
got, _ := ParseActorID(item, "forgejo")
|
||||||
|
|
||||||
if got != want {
|
if got != want {
|
||||||
t.Errorf("ParseActorID returned non empty actor id for empty input.")
|
t.Errorf("ParseActorID returned non empty actor id for empty input.")
|
||||||
|
@ -40,17 +40,17 @@ func TestActorParserEmpty(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestActorParserValid(t *testing.T) {
|
func TestActorParserValid(t *testing.T) {
|
||||||
item := mockStar
|
item := mockStar.Actor.GetID().String()
|
||||||
want := ActorID{
|
want := ActorID{
|
||||||
userId: "1",
|
userId: "1",
|
||||||
source: "forgejo",
|
source: "forgejo",
|
||||||
schema: "https",
|
schema: "https",
|
||||||
path: "/api/v1/activitypub/user-id/1",
|
path: "api/v1/activitypub/user-id",
|
||||||
host: "repo.prod.meissa.de",
|
host: "repo.prod.meissa.de",
|
||||||
port: "",
|
port: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
got, _ := ParseActorIDFromStarActivity(item)
|
got, _ := ParseActorID(item, "forgejo")
|
||||||
|
|
||||||
if got != want {
|
if got != want {
|
||||||
t.Errorf("\nParseActorID did not return want: %v\n but %v", want, got)
|
t.Errorf("\nParseActorID did not return want: %v\n but %v", want, got)
|
||||||
|
@ -73,9 +73,9 @@ func TestValidateValid(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateInvalid(t *testing.T) {
|
func TestValidateInvalid(t *testing.T) {
|
||||||
item := emptyMockStar
|
item := emptyMockStar.Actor.GetID().String()
|
||||||
|
|
||||||
actor, _ := ParseActorIDFromStarActivity(item)
|
actor, _ := ParseActorID(item, "forgejo")
|
||||||
|
|
||||||
if valid, _ := actor.IsValid(); valid {
|
if valid, _ := actor.IsValid(); valid {
|
||||||
t.Errorf("Actor was valid with invalid input.")
|
t.Errorf("Actor was valid with invalid input.")
|
||||||
|
|
Loading…
Reference in a new issue