Test fixes + add remove from outbox collection step

This commit is contained in:
Armin 2019-02-27 02:34:44 +01:00
parent 9e5b6865b8
commit e48ce8a94e
6 changed files with 62 additions and 35 deletions

View File

@ -0,0 +1,55 @@
Feature: Delete an object
I want to delete objects
Background:
Given our own server runs at "http://localhost:4100"
And we have the following users in our database:
| Slug |
| bernd-das-brot|
And I send a POST request with the following activity to "/activitypub/users/bernd-das-brot/inbox":
"""
{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://aronda.org/users/bernd-das-brot/status/lka7dfzkjn2398hsfd",
"type": "Create",
"actor": "https://aronda.org/users/bernd-das-brot",
"object": {
"id": "https://aronda.org/users/bernd-das-brot/status/kljsdfg9843jknsdf",
"type": "Article",
"published": "2019-02-07T19:37:55.002Z",
"attributedTo": "https://aronda.org/users/bernd-das-brot",
"content": "Hi Max, how are you?",
"to": "https://localhost:4100/activitypub/users/moritz"
}
}
"""
Scenario: Deleting a post (Article Object)
When I send a POST request with the following activity to "/activitypub/users/bernd-das-brot/inbox":
"""
{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://localhost:4100/users/karl-heinz/status/a4DJ2afdg323v32641vna42lkj685kasd2",
"type": "Delete",
"object": {
"id": "https://aronda.org/users/bernd-das-brot/status/kljsdfg9843jknsdf",
"type": "Article",
"published": "2019-02-07T19:37:55.002Z",
"attributedTo": "https://aronda.org/users/bernd-das-brot",
"content": "Hi Max, how are you?",
"to": "https://localhost:4100/activitypub/users/moritz"
}
}
"""
Then I expect the status code to be 200
And the object is removed from the outbox collection of "bernd-das-brot"
"""
{
"id": "https://aronda.org/users/bernd-das-brot/status/kljsdfg9843jknsdf",
"type": "Article",
"published": "2019-02-07T19:37:55.002Z",
"attributedTo": "https://aronda.org/users/bernd-das-brot",
"content": "Hi Max, how are you?",
"to": "https://localhost:4100/activitypub/users/moritz"
}
"""

View File

@ -1,28 +0,0 @@
Feature: Delete an object
I want to delete objects
Background:
Given our own server runs at "http://localhost:4100"
And we have the following users in our database:
| Slug |
| bernd-das-brot|
Scenario: Deleting a post (Article Object)
When I send a POST request with the following activity to "/activitypub/users/bernd-das-brot/inbox":
"""
{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://localhost:4100/users/karl-heinz/status/a4DJ2afdg323v32641vna42lkj685kasd2",
"type": "Delete",
"object": {
"id": "https://aronda.org/users/marvin/status/kljsdfg9843jknsdf",
"type": "Article",
"published": "2019-02-07T19:37:55.002Z",
"attributedTo": "https://aronda.org/users/marvin",
"content": "Hi John, how are you?",
"to": "https://localhost:4100/activitypub/users/max"
}
}
"""
Then I expect the status code to be 200
And the object is removed from the outbox collection of "karl-heinz"

View File

@ -36,7 +36,6 @@ Feature: Follow a user
"type": "Undo",
"actor": "http://localhost:4123/activitypub/users/peter-lustiger",
"object": {
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://localhost:4123/activitypub/users/bob-der-baumeister/status/83J23549sda1k72fsa4567na42312455kad83",
"type": "Follow",
"actor": "http://localhost:4123/activitypub/users/bob-der-baumeister",

View File

@ -21,7 +21,7 @@ Feature: Send and receive Articles
"type": "Article",
"published": "2019-02-07T19:37:55.002Z",
"attributedTo": "https://aronda.org/users/marvin",
"content": "Hi John, how are you?",
"content": "Hi Max, how are you?",
"to": "https://localhost:4100/activitypub/users/max"
}
}

View File

@ -108,16 +108,17 @@ Then('the post with id {string} to be created', async function (id) {
const result = await client.request(`
query {
Post(id: "${id}") {
name
title
}
}
`)
expect(result.data.Post).to.be.an('array').that.is.not.empty // eslint-disable-line
})
Then('the object is removed from the outbox collection of {string}', (name) => {
Then('the object is removed from the outbox collection of {string}', async function (name, object) {
const response = await this.get(`/activitypub/users/${name}/outbox?page=true`)
const parsedResponse = JSON.parse(response.lastResponse)
expect(parsedResponse.orderedItems).to.not.include(object)
})
Then('I send a GET request to {string} and expect a ordered collection', () => {

View File

@ -10,7 +10,7 @@ class CustomWorld {
this.lastContentType = null
this.lastInboxUrl = null
this.lastActivity = null
// activity-article.feature.disable
// object-article.feature
this.statusCode = null
}
get (pathname) {