Changes
3 changed files (+5/-203)
-
-
@@ -111,37 +111,27 @@ func actorNew(id as.ObjectID, typ as.ActivityVocabularyType) *actor {// ApplicationNew initializes an Application type actor func ApplicationNew(id as.ObjectID) *Application { a := actorNew(id, as.ApplicationType) o := Application(*a) return &o return actorNew(id, as.ApplicationType) } // GroupNew initializes a Group type actor func GroupNew(id as.ObjectID) *Group { a := actorNew(id, as.GroupType) o := Group(*a) return &o return actorNew(id, as.GroupType) } // OrganizationNew initializes an Organization type actor func OrganizationNew(id as.ObjectID) *Organization { a := actorNew(id, as.OrganizationType) o := Organization(*a) return &o return actorNew(id, as.OrganizationType) } // PersonNew initializes a Person type actor func PersonNew(id as.ObjectID) *Person { a := actorNew(id, as.PersonType) o := Person(*a) return &o return actorNew(id, as.PersonType) } // ServiceNew initializes a Service type actor func ServiceNew(id as.ObjectID) *Service { a := actorNew(id, as.ServiceType) o := Service(*a) return &o return actorNew(id, as.ServiceType) } func (a *actor) UnmarshalJSON(data []byte) error {
-
-
-
@@ -2,7 +2,6 @@ package activitypubimport ( as "github.com/go-ap/activitystreams" "reflect" "testing" )
-
@@ -88,155 +87,10 @@ func TestServiceNew(t *testing.T) {} } func TestActor_IsLink(t *testing.T) { m := actorNew("test", as.ActorType) if m.IsLink() { t.Errorf("%#v should not be a valid Link", m.Type) } } func TestActor_IsObject(t *testing.T) { m := actorNew("test", as.ActorType) if !m.IsObject() { t.Errorf("%#v should be a valid object", m.Type) } } func TestActor_Object(t *testing.T) { m := actorNew("test", as.ActorType) if reflect.DeepEqual(as.ObjectID(""), m.GetID()) { t.Errorf("%#v should not be an empty activity pub object", m.GetID()) } } func TestActor_Type(t *testing.T) { m := actorNew("test", as.ActorType) if m.GetType() != as.ActorType { t.Errorf("%#v should be an empty Link object", m.GetType()) } } func TestPerson_IsLink(t *testing.T) { m := PersonNew("test") if m.IsLink() { t.Errorf("%T should not be a valid Link", m) } } func TestPerson_IsObject(t *testing.T) { m := PersonNew("test") if !m.IsObject() { t.Errorf("%T should be a valid object", m) } } func TestActor_UnmarshalJSON(t *testing.T) { t.Skipf("TODO") } func TestActor_GetActor(t *testing.T) { t.Skipf("TODO") } func TestActor_GetID(t *testing.T) { t.Skipf("TODO") } func TestActor_GetLink(t *testing.T) { t.Skipf("TODO") } func TestActor_GetType(t *testing.T) { t.Skipf("TODO") } func TestApplication_GetActor(t *testing.T) { t.Skipf("TODO") } func TestApplication_GetID(t *testing.T) { t.Skipf("TODO") } func TestApplication_GetLink(t *testing.T) { t.Skipf("TODO") } func TestApplication_GetType(t *testing.T) { t.Skipf("TODO") } func TestApplication_IsLink(t *testing.T) { t.Skipf("TODO") } func TestApplication_IsObject(t *testing.T) { t.Skipf("TODO") } func TestGroup_GetActor(t *testing.T) { t.Skipf("TODO") } func TestGroup_GetID(t *testing.T) { t.Skipf("TODO") } func TestGroup_GetLink(t *testing.T) { t.Skipf("TODO") } func TestGroup_GetType(t *testing.T) { t.Skipf("TODO") } func TestGroup_IsLink(t *testing.T) { t.Skipf("TODO") } func TestGroup_IsObject(t *testing.T) { t.Skipf("TODO") } func TestOrganization_GetActor(t *testing.T) { t.Skipf("TODO") } func TestOrganization_GetID(t *testing.T) { t.Skipf("TODO") } func TestOrganization_GetLink(t *testing.T) { t.Skipf("TODO") } func TestOrganization_GetType(t *testing.T) { t.Skipf("TODO") } func TestOrganization_IsLink(t *testing.T) { t.Skipf("TODO") } func TestOrganization_IsObject(t *testing.T) { t.Skipf("TODO") } func TestPerson_GetActor(t *testing.T) { t.Skipf("TODO") } func TestPerson_GetID(t *testing.T) { t.Skipf("TODO") } func TestPerson_GetLink(t *testing.T) { t.Skipf("TODO") } func TestPerson_GetType(t *testing.T) { t.Skipf("TODO") } func validateEmptyPerson(p Person, t *testing.T) { if p.ID != "" { t.Errorf("Unmarshalled object %T should have empty ID, received %q", p, p.ID)
-
-
errors.go (deleted)
-
@@ -1,42 +0,0 @@package activitypub import ( "fmt" as "github.com/go-ap/activitystreams" ) type causer interface { // Cause returns the parent error Cause() error } // Error is an local error type // It should contain the ActivityPub object that generated the error type Error struct { on as.Item msg string parent error } // Error implements the errors interface func (e Error) Error() string { return fmt.Sprintf("%s %s", e.msg, *e.on.GetID()) } // Cause returns the parent error func (e Error) Cause() error { return e.parent } func (e Error) Is(err error) bool { for { if err == e { return true } if e, ok := err.(causer); ok { err = e.Cause() } else { return false } } }
-