Fixed errors resulting from using local Object types
This commit is contained in:
parent
0ff0c8c86f
commit
c69bcfeaeb
|
@ -202,13 +202,13 @@ var allTests = tests{
|
||||||
"object_with_url": testPair{
|
"object_with_url": testPair{
|
||||||
expected: true,
|
expected: true,
|
||||||
blank: &ap.Object{},
|
blank: &ap.Object{},
|
||||||
result: &ap.Object{Parent: a.Object{URL: a.IRI("http://littr.git/api/accounts/system")}},
|
result: &ap.Object{Parent: a.Parent{URL: a.IRI("http://littr.git/api/accounts/system")}},
|
||||||
},
|
},
|
||||||
"object_with_url_collection": testPair{
|
"object_with_url_collection": testPair{
|
||||||
expected: true,
|
expected: true,
|
||||||
blank: &ap.Object{},
|
blank: &ap.Object{},
|
||||||
result: &ap.Object{
|
result: &ap.Object{
|
||||||
Parent: a.Object{
|
Parent: a.Parent{
|
||||||
URL: a.ItemCollection{
|
URL: a.ItemCollection{
|
||||||
a.IRI("http://littr.git/api/accounts/system"),
|
a.IRI("http://littr.git/api/accounts/system"),
|
||||||
a.IRI("http://littr.git/~system"),
|
a.IRI("http://littr.git/~system"),
|
||||||
|
@ -220,12 +220,13 @@ var allTests = tests{
|
||||||
expected: true,
|
expected: true,
|
||||||
blank: &ap.Object{},
|
blank: &ap.Object{},
|
||||||
result: &ap.Object{
|
result: &ap.Object{
|
||||||
Parent: a.Object{
|
Parent: a.Parent{
|
||||||
Type: a.ObjectType,
|
Type: a.ObjectType,
|
||||||
ID: a.ObjectID("http://www.test.example/object/1"),
|
ID: a.ObjectID("http://www.test.example/object/1"),
|
||||||
Name: a.NaturalLanguageValues{{
|
Name: a.NaturalLanguageValues{{
|
||||||
a.NilLangRef, "A Simple, non-specific object",
|
a.NilLangRef, "A Simple, non-specific object",
|
||||||
}},
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -240,14 +241,12 @@ var allTests = tests{
|
||||||
a.NilLangRef, "A Simple, non-specific object",
|
a.NilLangRef, "A Simple, non-specific object",
|
||||||
}},
|
}},
|
||||||
Tag: a.ItemCollection{
|
Tag: a.ItemCollection{
|
||||||
&ap.Object{
|
&a.Object{
|
||||||
Parent: a.Parent {
|
|
||||||
Name: a.NaturalLanguageValues{{
|
Name: a.NaturalLanguageValues{{
|
||||||
a.NilLangRef, "#my_tag",
|
a.NilLangRef, "#my_tag",
|
||||||
}},
|
}},
|
||||||
ID: a.ObjectID("http://example.com/tag/my_tag"),
|
ID: a.ObjectID("http://example.com/tag/my_tag"),
|
||||||
},
|
},
|
||||||
},
|
|
||||||
&a.Mention{
|
&a.Mention{
|
||||||
Name: a.NaturalLanguageValues{{
|
Name: a.NaturalLanguageValues{{
|
||||||
a.NilLangRef, "@ana",
|
a.NilLangRef, "@ana",
|
||||||
|
@ -263,7 +262,7 @@ var allTests = tests{
|
||||||
expected: true,
|
expected: true,
|
||||||
blank: &ap.Object{},
|
blank: &ap.Object{},
|
||||||
result: &ap.Object{
|
result: &ap.Object{
|
||||||
Parent: a.Object{
|
Parent: a.Parent{
|
||||||
Type: a.ObjectType,
|
Type: a.ObjectType,
|
||||||
ID: a.ObjectID("http://www.test.example/object/1"),
|
ID: a.ObjectID("http://www.test.example/object/1"),
|
||||||
Replies: &a.Collection{
|
Replies: &a.Collection{
|
||||||
|
@ -273,7 +272,8 @@ var allTests = tests{
|
||||||
},
|
},
|
||||||
TotalItems: 1,
|
TotalItems: 1,
|
||||||
Items: a.ItemCollection{
|
Items: a.ItemCollection{
|
||||||
&a.Object{
|
&ap.Object{
|
||||||
|
Parent: a.Parent{
|
||||||
ID: a.ObjectID("http://www.test.example/object/1/replies/2"),
|
ID: a.ObjectID("http://www.test.example/object/1/replies/2"),
|
||||||
Type: a.ArticleType,
|
Type: a.ArticleType,
|
||||||
Name: a.NaturalLanguageValues{{a.NilLangRef, "Example title"}},
|
Name: a.NaturalLanguageValues{{a.NilLangRef, "Example title"}},
|
||||||
|
@ -283,6 +283,7 @@ var allTests = tests{
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
"person_with_outbox": testPair{
|
"person_with_outbox": testPair{
|
||||||
expected: true,
|
expected: true,
|
||||||
blank: &ap.Person{},
|
blank: &ap.Person{},
|
||||||
|
@ -314,7 +315,8 @@ var allTests = tests{
|
||||||
},
|
},
|
||||||
TotalItems: 1,
|
TotalItems: 1,
|
||||||
OrderedItems: a.ItemCollection{
|
OrderedItems: a.ItemCollection{
|
||||||
&a.Object{
|
&ap.Object{
|
||||||
|
Parent: a.Parent{
|
||||||
ID: a.ObjectID("http://example.com/outbox/53c6fb47"),
|
ID: a.ObjectID("http://example.com/outbox/53c6fb47"),
|
||||||
Type: a.ArticleType,
|
Type: a.ArticleType,
|
||||||
Name: a.NaturalLanguageValues{{a.NilLangRef, "Example title"}},
|
Name: a.NaturalLanguageValues{{a.NilLangRef, "Example title"}},
|
||||||
|
@ -328,6 +330,7 @@ var allTests = tests{
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
"ordered_collection_page": testPair{
|
"ordered_collection_page": testPair{
|
||||||
expected: true,
|
expected: true,
|
||||||
blank: &a.OrderedCollectionPage{},
|
blank: &a.OrderedCollectionPage{},
|
||||||
|
@ -344,7 +347,8 @@ var allTests = tests{
|
||||||
Current: a.IRI("http://example.com/outbox?page=2"),
|
Current: a.IRI("http://example.com/outbox?page=2"),
|
||||||
TotalItems: 1,
|
TotalItems: 1,
|
||||||
OrderedItems: a.ItemCollection{
|
OrderedItems: a.ItemCollection{
|
||||||
&a.Object{
|
&ap.Object{
|
||||||
|
Parent: a.Parent{
|
||||||
ID: a.ObjectID("http://example.com/outbox/53c6fb47"),
|
ID: a.ObjectID("http://example.com/outbox/53c6fb47"),
|
||||||
Type: a.ArticleType,
|
Type: a.ArticleType,
|
||||||
Name: a.NaturalLanguageValues{{a.NilLangRef, "Example title"}},
|
Name: a.NaturalLanguageValues{{a.NilLangRef, "Example title"}},
|
||||||
|
@ -359,6 +363,7 @@ var allTests = tests{
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
"natural_language_values": {
|
"natural_language_values": {
|
||||||
expected: true,
|
expected: true,
|
||||||
blank: &a.NaturalLanguageValues{},
|
blank: &a.NaturalLanguageValues{},
|
||||||
|
@ -380,15 +385,17 @@ var allTests = tests{
|
||||||
Type: a.CreateType,
|
Type: a.CreateType,
|
||||||
},
|
},
|
||||||
Actor: a.IRI("https://littr.git/api/accounts/anonymous"),
|
Actor: a.IRI("https://littr.git/api/accounts/anonymous"),
|
||||||
Object: &a.Object{
|
Object: &ap.Object{
|
||||||
|
Parent: a.Parent{
|
||||||
Type: a.NoteType,
|
Type: a.NoteType,
|
||||||
AttributedTo: a.IRI("https://littr.git/api/accounts/anonymous"),
|
AttributedTo: a.IRI("https://littr.git/api/accounts/anonymous"),
|
||||||
InReplyTo: a.IRI("https://littr.git/api/accounts/system/outbox/7ca154ff"),
|
InReplyTo: a.ItemCollection{a.IRI("https://littr.git/api/accounts/system/outbox/7ca154ff")},
|
||||||
Content: a.NaturalLanguageValues{{a.NilLangRef, "<p>Hello world</p>"}},
|
Content: a.NaturalLanguageValues{{a.NilLangRef, "<p>Hello world</p>"}},
|
||||||
To: a.ItemCollection{a.IRI("https://www.w3.org/ns/activitystreams#Public")},
|
To: a.ItemCollection{a.IRI("https://www.w3.org/ns/activitystreams#Public")},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
"like_activity_with_iri_actor": {
|
"like_activity_with_iri_actor": {
|
||||||
expected: true,
|
expected: true,
|
||||||
blank: &a.Like{},
|
blank: &a.Like{},
|
||||||
|
@ -398,17 +405,19 @@ var allTests = tests{
|
||||||
Published: time.Date(2018, time.September, 6, 15, 15, 9, 0, zLoc),
|
Published: time.Date(2018, time.September, 6, 15, 15, 9, 0, zLoc),
|
||||||
},
|
},
|
||||||
Actor: a.IRI("https://littr.git/api/accounts/24d4b96f"),
|
Actor: a.IRI("https://littr.git/api/accounts/24d4b96f"),
|
||||||
Object: &a.Article{
|
Object: &ap.Object{
|
||||||
|
Parent: a.Article{
|
||||||
ID: a.ObjectID("https://littr.git/api/accounts/ana/liked/7ca154ff"),
|
ID: a.ObjectID("https://littr.git/api/accounts/ana/liked/7ca154ff"),
|
||||||
Type: a.ArticleType,
|
Type: a.ArticleType,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
"object_with_audience": testPair{
|
"object_with_audience": testPair{
|
||||||
expected: true,
|
expected: true,
|
||||||
blank: &ap.Object{},
|
blank: &ap.Object{},
|
||||||
result: &ap.Object{
|
result: &ap.Object{
|
||||||
Parent: a.Object{
|
Parent: a.Parent{
|
||||||
Type: a.ObjectType,
|
Type: a.ObjectType,
|
||||||
ID: a.ObjectID("http://www.test.example/object/1"),
|
ID: a.ObjectID("http://www.test.example/object/1"),
|
||||||
To: a.ItemCollection{
|
To: a.ItemCollection{
|
||||||
|
@ -447,7 +456,7 @@ func getFileContents(path string) ([]byte, error) {
|
||||||
return data, nil
|
return data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_ActivityPubUnmarshall(t *testing.T) {
|
func Test_ActivityPubUnmarshal(t *testing.T) {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
var f = t.Errorf
|
var f = t.Errorf
|
||||||
|
|
Reference in a new issue