2019-12-03 19:45:26 +00:00
|
|
|
package tests
|
2018-03-27 15:28:09 +00:00
|
|
|
|
2018-04-10 15:53:05 +00:00
|
|
|
// Server to Server tests from: https://test.activitypub.rocks/
|
2018-03-27 15:28:09 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2019-12-03 19:45:26 +00:00
|
|
|
pub "github.com/go-ap/activitypub"
|
2018-03-27 15:28:09 +00:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2018-03-27 15:40:25 +00:00
|
|
|
// S2S Server: Activities requiring the object property
|
|
|
|
// The distribution of the following activities require that they contain the object property:
|
|
|
|
// Create, Update, Delete, Follow, Add, Remove, Like, Block, Undo.
|
2018-04-10 18:53:08 +00:00
|
|
|
// Implementation always includes object property for each of the above supported activities
|
2018-04-10 18:29:55 +00:00
|
|
|
func TestObjectPropertyExists(t *testing.T) {
|
2018-04-10 18:53:08 +00:00
|
|
|
desc := `
|
2018-04-10 18:29:55 +00:00
|
|
|
S2S Server: Activities requiring the object property
|
2018-04-10 18:53:08 +00:00
|
|
|
The distribution of the following activities require that they contain the object property:
|
2018-04-10 18:29:55 +00:00
|
|
|
Create, Update, Delete, Follow, Add, Remove, Like, Block, Undo.
|
2018-04-10 18:53:08 +00:00
|
|
|
|
|
|
|
Implementation always includes object property for each of the above supported activities
|
|
|
|
`
|
|
|
|
t.Log(desc)
|
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
obj := pub.MentionNew("gigel")
|
2018-03-27 15:28:09 +00:00
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
add := pub.AddNew("https://localhost/myactivity", obj, nil)
|
2018-03-27 15:28:09 +00:00
|
|
|
if add.Object == nil {
|
2018-06-09 12:05:46 +00:00
|
|
|
t.Errorf("Missing GetID in Add activity %#v", add.Object)
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
|
|
|
if add.Object != obj {
|
2018-06-09 12:05:46 +00:00
|
|
|
t.Errorf("Add.GetID different than what we initialized %#v %#v", add.Object, obj)
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
block := pub.BlockNew("https://localhost/myactivity", obj)
|
2018-03-27 15:28:09 +00:00
|
|
|
if block.Object == nil {
|
2018-06-09 12:05:46 +00:00
|
|
|
t.Errorf("Missing GetID in Add activity %#v", block.Object)
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
|
|
|
if block.Object != obj {
|
2018-06-09 12:05:46 +00:00
|
|
|
t.Errorf("Block.GetID different than what we initialized %#v %#v", block.Object, obj)
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
create := pub.CreateNew("https://localhost/myactivity", obj)
|
2018-03-27 15:28:09 +00:00
|
|
|
if create.Object == nil {
|
2018-06-09 12:05:46 +00:00
|
|
|
t.Errorf("Missing GetID in Add activity %#v", create.Object)
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
|
|
|
if create.Object != obj {
|
2018-06-09 12:05:46 +00:00
|
|
|
t.Errorf("Create.GetID different than what we initialized %#v %#v", create.Object, obj)
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
delete := pub.DeleteNew("https://localhost/myactivity", obj)
|
2018-03-27 15:28:09 +00:00
|
|
|
if delete.Object == nil {
|
2018-06-09 12:05:46 +00:00
|
|
|
t.Errorf("Missing GetID in Delete activity %#v", delete.Object)
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
|
|
|
if delete.Object != obj {
|
2018-06-09 12:05:46 +00:00
|
|
|
t.Errorf("Delete.GetID different than what we initialized %#v %#v", delete.Object, obj)
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
follow := pub.FollowNew("https://localhost/myactivity", obj)
|
2018-03-27 15:28:09 +00:00
|
|
|
if follow.Object == nil {
|
2018-06-09 12:05:46 +00:00
|
|
|
t.Errorf("Missing GetID in Follow activity %#v", follow.Object)
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
|
|
|
if follow.Object != obj {
|
2018-06-09 12:05:46 +00:00
|
|
|
t.Errorf("Follow.GetID different than what we initialized %#v %#v", follow.Object, obj)
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
like := pub.LikeNew("https://localhost/myactivity", obj)
|
2018-04-10 18:29:55 +00:00
|
|
|
if like.Object == nil {
|
2018-06-09 12:05:46 +00:00
|
|
|
t.Errorf("Missing GetID in Like activity %#v", like.Object)
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
2018-04-10 18:29:55 +00:00
|
|
|
if like.Object != obj {
|
2018-06-09 12:05:46 +00:00
|
|
|
t.Errorf("Like.GetID different than what we initialized %#v %#v", add.Object, obj)
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
update := pub.UpdateNew("https://localhost/myactivity", obj)
|
2018-03-27 15:28:09 +00:00
|
|
|
if update.Object == nil {
|
2018-06-09 12:05:46 +00:00
|
|
|
t.Errorf("Missing GetID in Update activity %#v", update.Object)
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
|
|
|
if update.Object != obj {
|
2018-06-09 12:05:46 +00:00
|
|
|
t.Errorf("Update.GetID different than what we initialized %#v %#v", update.Object, obj)
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
undo := pub.UndoNew("https://localhost/myactivity", obj)
|
2018-03-27 15:28:09 +00:00
|
|
|
if undo.Object == nil {
|
2018-06-09 12:05:46 +00:00
|
|
|
t.Errorf("Missing GetID in Undo activity %#v", undo.Object)
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
|
|
|
if undo.Object != obj {
|
2018-06-09 12:05:46 +00:00
|
|
|
t.Errorf("Undo.GetID different than what we initialized %#v %#v", undo.Object, obj)
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-27 15:40:25 +00:00
|
|
|
// S2S Server: Activities requiring the target property
|
2018-04-10 18:53:08 +00:00
|
|
|
// The distribution of the following activities require that they contain the target property:
|
2018-10-18 09:48:02 +00:00
|
|
|
// Add, Remove.
|
2018-04-10 18:53:08 +00:00
|
|
|
// Implementation always includes target property for each of the above supported activities.
|
2018-04-10 18:29:55 +00:00
|
|
|
func TestTargetPropertyExists(t *testing.T) {
|
2018-04-10 18:53:08 +00:00
|
|
|
desc := `
|
2018-04-10 18:29:55 +00:00
|
|
|
S2S Server: Activities requiring the target property
|
2018-04-10 18:53:08 +00:00
|
|
|
The distribution of the following activities require that they contain the target
|
|
|
|
property: Add, Remove.
|
|
|
|
|
|
|
|
Implementation always includes target property for each of the above supported activities.
|
|
|
|
`
|
|
|
|
t.Log(desc)
|
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
obj := pub.MentionNew("foo")
|
|
|
|
target := pub.MentionNew("bar")
|
2018-03-27 15:40:25 +00:00
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
add := pub.AddNew("https://localhost/myactivity", obj, target)
|
2018-03-27 15:40:25 +00:00
|
|
|
if add.Target == nil {
|
|
|
|
t.Errorf("Missing Target in Add activity %#v", add.Target)
|
|
|
|
}
|
|
|
|
if add.Target != target {
|
|
|
|
t.Errorf("Add.Target different than what we initialized %#v %#v", add.Target, target)
|
|
|
|
}
|
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
remove := pub.RemoveNew("https://localhost/myactivity", obj, target)
|
2018-03-27 15:40:25 +00:00
|
|
|
if remove.Target == nil {
|
|
|
|
t.Errorf("Missing Target in Remove activity %#v", remove.Target)
|
|
|
|
}
|
|
|
|
if remove.Target != target {
|
|
|
|
t.Errorf("Remove.Target different than what we initialized %#v %#v", remove.Target, target)
|
|
|
|
}
|
2018-03-27 15:28:09 +00:00
|
|
|
}
|
2018-04-07 10:34:57 +00:00
|
|
|
|
|
|
|
// S2S Server: Deduplication of recipient list
|
2018-04-10 18:53:08 +00:00
|
|
|
// Attempt to submit for delivery an activity that addresses the same actor
|
|
|
|
// (ie an actor with the same id) twice.
|
|
|
|
// (For example, the same actor could appear on both the to and cc fields,
|
2018-10-18 09:48:02 +00:00
|
|
|
// or the actor could be explicitly addressed
|
2018-04-07 10:34:57 +00:00
|
|
|
// in to but could also be a member of the addressed followers collection of the sending actor.)
|
|
|
|
// The server should deduplicate the list of inboxes to deliver to before delivering.
|
2018-04-10 18:53:08 +00:00
|
|
|
// The final recipient list is deduplicated before delivery.
|
2018-04-10 15:53:05 +00:00
|
|
|
func TestDeduplication(t *testing.T) {
|
2018-04-10 18:53:08 +00:00
|
|
|
desc := `
|
2018-04-10 18:29:55 +00:00
|
|
|
S2S Server: Deduplication of recipient list
|
2018-04-10 18:53:08 +00:00
|
|
|
Attempt to submit for delivery an activity that addresses the same actor
|
|
|
|
(ie an actor with the same id) twice.
|
|
|
|
|
|
|
|
The final recipient list is deduplicated before delivery.
|
|
|
|
`
|
|
|
|
t.Log(desc)
|
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
to := pub.PersonNew("bob")
|
|
|
|
o := pub.ObjectNew(pub.ArticleType)
|
|
|
|
cc := pub.PersonNew("alice")
|
2018-04-10 15:53:05 +00:00
|
|
|
|
2018-10-11 09:26:00 +00:00
|
|
|
o.ID = "something"
|
2019-12-03 19:45:26 +00:00
|
|
|
c := pub.CreateNew("create", o)
|
2018-04-10 15:53:05 +00:00
|
|
|
c.To.Append(to)
|
|
|
|
c.CC.Append(cc)
|
|
|
|
c.BCC.Append(cc)
|
|
|
|
|
2019-05-31 13:02:42 +00:00
|
|
|
c.Recipients()
|
2018-04-10 15:53:05 +00:00
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
checkDedup := func(list pub.ItemCollection, recIds *[]pub.ObjectID) error {
|
2018-04-10 15:53:05 +00:00
|
|
|
for _, rec := range list {
|
|
|
|
for _, id := range *recIds {
|
2019-12-03 16:23:59 +00:00
|
|
|
if rec.GetID() == id {
|
2018-04-10 15:53:05 +00:00
|
|
|
return fmt.Errorf("%T[%s] already stored in recipients list, Deduplication faild", rec, id)
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 16:23:59 +00:00
|
|
|
*recIds = append(*recIds, rec.GetID())
|
2018-04-10 15:53:05 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
var err error
|
2019-12-03 19:45:26 +00:00
|
|
|
recIds := make([]pub.ObjectID, 0)
|
2018-04-10 18:53:08 +00:00
|
|
|
err = checkDedup(c.To, &recIds)
|
2018-04-10 15:53:05 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
2018-04-10 18:53:08 +00:00
|
|
|
err = checkDedup(c.Bto, &recIds)
|
2018-04-10 15:53:05 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
2018-04-10 18:53:08 +00:00
|
|
|
err = checkDedup(c.CC, &recIds)
|
2018-04-10 15:53:05 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
2018-04-10 18:53:08 +00:00
|
|
|
err = checkDedup(c.BCC, &recIds)
|
2018-04-10 15:53:05 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
}
|
2018-04-10 18:53:08 +00:00
|
|
|
|
|
|
|
// S2S Server: Do-not-deliver considerations
|
|
|
|
// Server does not deliver to recipients which are the same as the actor of the
|
|
|
|
// Activity being notified about
|
|
|
|
func TestDoNotDeliverToActor(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Do-not-deliver considerations
|
|
|
|
|
|
|
|
Server does not deliver to recipients which are the same as the actor of the
|
|
|
|
Activity being notified about
|
|
|
|
`
|
2018-06-05 18:59:04 +00:00
|
|
|
t.Log(desc)
|
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
p := pub.PersonNew("main actor")
|
2018-06-05 18:59:04 +00:00
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
to := pub.PersonNew("bob")
|
|
|
|
o := pub.ObjectNew(pub.ArticleType)
|
|
|
|
cc := pub.PersonNew("alice")
|
2018-06-05 18:59:04 +00:00
|
|
|
|
2018-10-11 09:26:00 +00:00
|
|
|
o.ID = "something"
|
2019-12-03 19:45:26 +00:00
|
|
|
c := pub.CreateNew("create", o)
|
|
|
|
c.Actor = *p
|
2018-06-05 18:59:04 +00:00
|
|
|
|
|
|
|
c.To.Append(p)
|
|
|
|
c.To.Append(to)
|
|
|
|
c.CC.Append(cc)
|
|
|
|
c.CC.Append(p)
|
|
|
|
c.BCC.Append(cc)
|
|
|
|
c.BCC.Append(p)
|
|
|
|
|
2019-05-31 13:02:42 +00:00
|
|
|
c.Recipients()
|
2018-06-05 18:59:04 +00:00
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
checkActor := func(list pub.ItemCollection, actor pub.Item) error {
|
2018-06-05 18:59:04 +00:00
|
|
|
for _, rec := range list {
|
2018-06-09 12:05:46 +00:00
|
|
|
if rec.GetID() == actor.GetID() {
|
2019-12-03 16:23:59 +00:00
|
|
|
return fmt.Errorf("%T[%s] Actor of activity should not be in the recipients list", rec, actor.GetID())
|
2018-06-05 18:59:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
var err error
|
|
|
|
err = checkActor(c.To, c.Actor)
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
err = checkActor(c.Bto, c.Actor)
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
err = checkActor(c.CC, c.Actor)
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
err = checkActor(c.BCC, c.Actor)
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
2018-04-10 18:53:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// S2S Server: Do-not-deliver considerations
|
|
|
|
// Server does not deliver Block activities to their object.
|
|
|
|
func TestDoNotDeliverBlockToObject(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Do-not-deliver considerations
|
|
|
|
|
|
|
|
Server does not deliver Block activities to their object.
|
|
|
|
`
|
2018-06-05 19:20:28 +00:00
|
|
|
t.Log(desc)
|
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
p := pub.PersonNew("blocked")
|
2018-06-05 19:20:28 +00:00
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
bob := pub.PersonNew("bob")
|
|
|
|
jane := pub.PersonNew("jane doe")
|
2018-06-05 19:20:28 +00:00
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
b := pub.BlockNew("block actor", p)
|
|
|
|
b.Actor = *bob
|
2018-06-05 19:20:28 +00:00
|
|
|
|
|
|
|
b.To.Append(jane)
|
|
|
|
b.To.Append(p)
|
|
|
|
b.To.Append(bob)
|
|
|
|
|
2019-05-31 13:02:42 +00:00
|
|
|
b.Recipients()
|
2018-06-05 19:20:28 +00:00
|
|
|
|
2019-12-03 19:45:26 +00:00
|
|
|
checkActor := func(list pub.ItemCollection, ob pub.Item) error {
|
2018-06-05 19:20:28 +00:00
|
|
|
for _, rec := range list {
|
2018-06-09 12:05:46 +00:00
|
|
|
if rec.GetID() == ob.GetID() {
|
2019-12-03 16:23:59 +00:00
|
|
|
return fmt.Errorf("%T[%s] of activity should not be in the recipients list", rec, ob.GetID())
|
2018-06-05 19:20:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
var err error
|
|
|
|
err = checkActor(b.To, b.Object)
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
err = checkActor(b.To, b.Actor)
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
2018-04-10 18:53:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// S2S Sever: Support for sharedInbox
|
|
|
|
// Delivers to sharedInbox endpoints to reduce the number of receiving actors delivered
|
|
|
|
// to by identifying all followers which share the same sharedInbox who would otherwise be
|
|
|
|
// individual recipients and instead deliver objects to said sharedInbox.
|
|
|
|
func TestSharedInboxIdentifySharedInbox(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Sever: Support for sharedInbox
|
|
|
|
|
|
|
|
Delivers to sharedInbox endpoints to reduce the number of receiving actors delivered
|
|
|
|
to by identifying all followers which share the same sharedInbox who would otherwise be
|
|
|
|
individual recipients and instead deliver objects to said sharedInbox.
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
// S2S Sever: Support for sharedInbox
|
2018-10-18 09:48:02 +00:00
|
|
|
// Deliver to actor inboxes and collections otherwise addressed which do not have a sharedInbox.
|
2018-04-10 18:53:08 +00:00
|
|
|
func TestSharedInboxActorsWOSharedInbox(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Do-not-deliver considerations
|
|
|
|
|
|
|
|
Server does not deliver Block activities to their object.
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
// S2S Server: Deduplicating received activities
|
|
|
|
// Server deduplicates activities received in inbox by comparing activity ids
|
|
|
|
func TestInboxDeduplication(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Deduplicating received activities
|
|
|
|
|
|
|
|
Server deduplicates activities received in inbox by comparing activity ids
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
// S2S Server: Special forwarding mechanism
|
|
|
|
// ActivityPub contains a special mechanism for forwarding replies to avoid "ghost replies".
|
2018-10-18 09:48:02 +00:00
|
|
|
// Forwards incoming activities to the values of to, bto, cc, bcc, audience if and only if criteria are met.
|
2018-04-10 18:53:08 +00:00
|
|
|
func TestForwardingMechanismsToRecipients(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Special forwarding mechanism
|
|
|
|
ActivityPub contains a special mechanism for forwarding replies to avoid "ghost replies".
|
|
|
|
|
|
|
|
Forwards incoming activities to the values of to, bto, cc, bcc, audience if and only if criteria are met.
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
// S2S Server: Special forwarding mechanism
|
|
|
|
// ActivityPub contains a special mechanism for forwarding replies to avoid "ghost replies".
|
2018-10-18 09:48:02 +00:00
|
|
|
// Recurse through to, bto, cc, bcc, audience object values to determine whether/where
|
2018-04-10 18:53:08 +00:00
|
|
|
// to forward according to criteria in 7.1.2
|
|
|
|
func TestForwardingMechanismsRecurseRecipients(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Special forwarding mechanism
|
|
|
|
ActivityPub contains a special mechanism for forwarding replies to avoid "ghost replies".
|
|
|
|
|
|
|
|
Recurse through to, bto, cc, bcc, audience object values to determine whether/where
|
|
|
|
to forward according to criteria in 7.1.2
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
// S2S Server: Special forwarding mechanism
|
|
|
|
// ActivityPub contains a special mechanism for forwarding replies to avoid "ghost replies".
|
2018-10-18 09:48:02 +00:00
|
|
|
// Limits depth of this recursion.
|
2018-04-10 18:53:08 +00:00
|
|
|
func TestForwardingMechanismsLimitsRecursion(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Special forwarding mechanism
|
|
|
|
ActivityPub contains a special mechanism for forwarding replies to avoid "ghost replies".
|
|
|
|
|
|
|
|
Limits depth of this recursion.
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
// S2S Server: Verification of content authorship
|
|
|
|
// Before accepting activities delivered to an actor's inbox some sort of verification
|
|
|
|
// should be performed. (For example, if the delivering actor has a public key on their profile,
|
|
|
|
// the request delivering the activity may be signed with HTTP Signatures.)
|
|
|
|
// Don't trust content received from a server other than the content's origin without some form of verification.
|
|
|
|
func TestVerification(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Verification of content authorship
|
|
|
|
Before accepting activities delivered to an actor's inbox some sort of verification
|
|
|
|
should be performed. (For example, if the delivering actor has a public key on their profile,
|
|
|
|
the request delivering the activity may be signed with HTTP Signatures.)
|
|
|
|
|
|
|
|
Don't trust content received from a server other than the content's origin without some form of verification.
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
// S2S Server: Update activity
|
|
|
|
// On receiving an Update activity to an actor's inbox, the server:
|
2018-10-18 09:48:02 +00:00
|
|
|
// Takes care to be sure that the Update is authorized to modify its object
|
2018-04-10 18:53:08 +00:00
|
|
|
func TestUpdateIsAuthorized(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Update activity
|
|
|
|
On receiving an Update activity to an actor's inbox, the server:
|
|
|
|
|
|
|
|
Takes care to be sure that the Update is authorized to modify its object
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
// S2S Server: Update activity
|
|
|
|
// On receiving an Update activity to an actor's inbox, the server:
|
2018-10-18 09:48:02 +00:00
|
|
|
// Completely replaces its copy of the activity with the newly received value
|
2018-04-10 18:53:08 +00:00
|
|
|
func TestUpdateReplacesActivity(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Update activity
|
|
|
|
On receiving an Update activity to an actor's inbox, the server:
|
|
|
|
|
|
|
|
Completely replaces its copy of the activity with the newly received value
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
// S2S Server: Delete activity
|
2018-10-18 09:48:02 +00:00
|
|
|
// Delete removes object's representation, assuming object is owned by sending actor/server
|
2018-04-10 18:53:08 +00:00
|
|
|
func TestDeleteRemoves(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Delete activity
|
|
|
|
|
|
|
|
Delete removes object's representation, assuming object is owned by sending actor/server
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
// S2S Server: Delete activity
|
2018-10-18 09:48:02 +00:00
|
|
|
// Replaces deleted object with a Tombstone object (optional)
|
2018-04-10 18:53:08 +00:00
|
|
|
func TestDeleteReplacesWithTombstone(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Delete activity
|
|
|
|
|
|
|
|
Replaces deleted object with a Tombstone object (optional)
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
//S2S Server: Following, and handling accept/reject of follows
|
2018-10-18 09:48:02 +00:00
|
|
|
// Follow should add the activity's actor to the receiving actor's Followers Collection.
|
2018-04-10 18:53:08 +00:00
|
|
|
func TestFollowAddsToFollowers(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Following, and handling accept/reject of follows
|
|
|
|
|
|
|
|
Follow should add the activity's actor to the receiving actor's Followers Collection.
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
//S2S Server: Following, and handling accept/reject of follows
|
2018-10-18 09:48:02 +00:00
|
|
|
// Generates either an Accept or Reject activity with Follow as object and deliver to actor of the Follow
|
2018-04-10 18:53:08 +00:00
|
|
|
func TestGeneratesAcceptOrReject(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Following, and handling accept/reject of follows
|
|
|
|
|
|
|
|
Generates either an Accept or Reject activity with Follow as object and deliver to actor of the Follow
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
//S2S Server: Following, and handling accept/reject of follows
|
2018-10-18 09:48:02 +00:00
|
|
|
// If receiving an Accept in reply to a Follow activity, adds actor to receiver's Following Collection
|
2018-04-10 18:53:08 +00:00
|
|
|
func TestAddsFollowerIfAccept(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Following, and handling accept/reject of follows
|
|
|
|
|
|
|
|
If receiving an Accept in reply to a Follow activity, adds actor to receiver's Following Collection
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
//S2S Server: Following, and handling accept/reject of follows
|
2018-10-18 09:48:02 +00:00
|
|
|
// If receiving a Reject in reply to a Follow activity, does not add actor to receiver's Following Collection
|
2018-04-10 18:53:08 +00:00
|
|
|
func TestDoesntAddFollowerIfReject(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Following, and handling accept/reject of follows
|
|
|
|
|
|
|
|
If receiving a Reject in reply to a Follow activity, does not add actor to receiver's Following Collection
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
//S2S Server: Activity acceptance side-effects
|
|
|
|
// Test accepting the following activities to an actor's inbox and observe the side effects:
|
|
|
|
//
|
2018-10-18 09:48:02 +00:00
|
|
|
// Create makes record of the object existing
|
2018-04-10 18:53:08 +00:00
|
|
|
func TestCreateMakesRecord(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Activity acceptance side-effects
|
|
|
|
Test accepting the following activities to an actor's inbox and observe the side effects:
|
|
|
|
|
|
|
|
Create makes record of the object existing
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
//S2S Server: Activity acceptance side-effects
|
|
|
|
// Test accepting the following activities to an actor's inbox and observe the side effects:
|
|
|
|
//
|
2018-10-18 09:48:02 +00:00
|
|
|
// Add should add the activity's object to the Collection specified in the target property,
|
|
|
|
// unless not allowed per requirements
|
2018-04-10 18:53:08 +00:00
|
|
|
func TestAddObjectToTarget(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Activity acceptance side-effects
|
|
|
|
Test accepting the following activities to an actor's inbox and observe the side effects:
|
|
|
|
|
|
|
|
Add should add the activity's object to the Collection specified in the target property,
|
|
|
|
unless not allowed per requirements
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
//S2S Server: Activity acceptance side-effects
|
|
|
|
// Test accepting the following activities to an actor's inbox and observe the side effects:
|
|
|
|
//
|
2018-10-18 09:48:02 +00:00
|
|
|
// Remove should remove the object from the Collection specified in the target property,
|
|
|
|
// unless not allowed per requirements
|
2018-04-10 18:53:08 +00:00
|
|
|
func TestRemoveObjectFromTarget(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Activity acceptance side-effects
|
|
|
|
Test accepting the following activities to an actor's inbox and observe the side effects:
|
|
|
|
|
|
|
|
Remove should remove the object from the Collection specified in the target property,
|
|
|
|
unless not allowed per requirements
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
//S2S Server: Activity acceptance side-effects
|
|
|
|
// Test accepting the following activities to an actor's inbox and observe the side effects:
|
|
|
|
//
|
2018-10-18 09:48:02 +00:00
|
|
|
// Like increments the object's count of likes by adding the received activity to the likes
|
|
|
|
// collection if this collection is present
|
2018-04-10 18:53:08 +00:00
|
|
|
func TestLikeIncrementsLikes(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Activity acceptance side-effects
|
|
|
|
Test accepting the following activities to an actor's inbox and observe the side effects:
|
|
|
|
|
|
|
|
Like increments the object's count of likes by adding the received activity to the likes
|
|
|
|
collection if this collection is present
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
//S2S Server: Activity acceptance side-effects
|
|
|
|
// Test accepting the following activities to an actor's inbox and observe the side effects:
|
|
|
|
//
|
2018-10-18 09:48:02 +00:00
|
|
|
// Announce increments object's count of shares by adding the received activity to the
|
2018-04-10 18:53:08 +00:00
|
|
|
// 'shares' collection if this collection is present
|
|
|
|
func TestAnnounceIncrementsShares(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Activity acceptance side-effects
|
|
|
|
Test accepting the following activities to an actor's inbox and observe the side effects:
|
|
|
|
|
|
|
|
Announce increments object's count of shares by adding the received activity to the
|
|
|
|
'shares' collection if this collection is present
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
//S2S Server: Activity acceptance side-effects
|
|
|
|
// Test accepting the following activities to an actor's inbox and observe the side effects:
|
|
|
|
//
|
2018-10-18 09:48:02 +00:00
|
|
|
// Undo performs Undo of object in federated context
|
2018-04-10 18:53:08 +00:00
|
|
|
func TestUndoPerformsUndoOnObject(t *testing.T) {
|
|
|
|
desc := `
|
|
|
|
S2S Server: Activity acceptance side-effects
|
|
|
|
Test accepting the following activities to an actor's inbox and observe the side effects:
|
|
|
|
|
|
|
|
Undo performs Undo of object in federated context
|
|
|
|
`
|
|
|
|
t.Skip(desc)
|
|
|
|
}
|