mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-28 19:29:02 +03:00
Split test according to actor.go
This commit is contained in:
parent
48cfb521d1
commit
1dd3084f66
1 changed files with 18 additions and 16 deletions
|
@ -53,8 +53,8 @@ func TestNewRepositoryId(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestPersonIdValidation(t *testing.T) {
|
||||
sut := PersonId{}
|
||||
func TestActorIdValidation(t *testing.T) {
|
||||
sut := ActorId{}
|
||||
sut.Source = "forgejo"
|
||||
sut.Schema = "https"
|
||||
sut.Path = "api/v1/activitypub/user-id"
|
||||
|
@ -65,7 +65,7 @@ func TestPersonIdValidation(t *testing.T) {
|
|||
t.Errorf("validation error expected but was: %v\n", sut.Validate())
|
||||
}
|
||||
|
||||
sut = PersonId{}
|
||||
sut = ActorId{}
|
||||
sut.Id = "1"
|
||||
sut.Source = "forgejox"
|
||||
sut.Schema = "https"
|
||||
|
@ -77,19 +77,7 @@ func TestPersonIdValidation(t *testing.T) {
|
|||
t.Errorf("validation error expected but was: %v\n", sut.Validate())
|
||||
}
|
||||
|
||||
sut = PersonId{}
|
||||
sut.Id = "1"
|
||||
sut.Source = "forgejo"
|
||||
sut.Schema = "https"
|
||||
sut.Path = "path"
|
||||
sut.Host = "an.other.host"
|
||||
sut.Port = ""
|
||||
sut.UnvalidatedInput = "https://an.other.host/path/1"
|
||||
if sut.Validate()[0] != "path: \"path\" has to be a api path" {
|
||||
t.Errorf("validation error expected but was: %v\n", sut.Validate())
|
||||
}
|
||||
|
||||
sut = PersonId{}
|
||||
sut = ActorId{}
|
||||
sut.Id = "1"
|
||||
sut.Source = "forgejo"
|
||||
sut.Schema = "https"
|
||||
|
@ -102,6 +90,20 @@ func TestPersonIdValidation(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestPersonIdValidation(t *testing.T) {
|
||||
sut := PersonId{}
|
||||
sut.Id = "1"
|
||||
sut.Source = "forgejo"
|
||||
sut.Schema = "https"
|
||||
sut.Path = "path"
|
||||
sut.Host = "an.other.host"
|
||||
sut.Port = ""
|
||||
sut.UnvalidatedInput = "https://an.other.host/path/1"
|
||||
if _, err := sut.IsValid(); err.Error() != "path: \"path\" has to be an api path" {
|
||||
t.Errorf("validation error expected but was: %v\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWebfingerId(t *testing.T) {
|
||||
sut, _ := NewPersonId("https://codeberg.org/api/v1/activitypub/user-id/12345", "forgejo")
|
||||
if sut.AsWebfinger() != "@12345@codeberg.org" {
|
||||
|
|
Loading…
Reference in a new issue