🐛 False negative cucumber test: CreatePost not authenticated
Created by: Tirokk
Authored by roschaefer Closed
🐛 Bugreport
The current implementation of activityPub.handleCreate
is using a hard-coded token for authentication. Apparently it's a token for a user who is in the seeds.
The problem with this is:
- All posts will be authored by that user
- If there is no user for that token in the DB, creating posts will fail because it's not authenticated
The latter problem is the reason why yarn run test:cucumber
fails if you don't have seeds in the database.
Steps to reproduce the behavior
yarn run db:reset
yarn run test:cucumber
- Fails with "
✖ And the post with id "kljsdfg9843jknsdf" to be created"
Expected behavior
Cucumber tests should ass
Additional context
2) Scenario: Send an article to a user inbox and make sure it's added to the inbox # features/object-article.feature:11
✔ Given our own server runs at "http://localhost:4123" # features/support/steps.js:23
✔ And we have the following users in our database: # features/support/steps.js:27
| Slug |
| marvin |
| max |
✔ When I send a POST request with the following activity to "/activitypub/users/max/inbox": # features/support/steps.js:41
"""
{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://aronda.org/users/marvin/status/lka7dfzkjn2398hsfd",
"type": "Create",
"actor": "https://aronda.org/users/marvin",
"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 Max, how are you?",
"to": "as:Public"
}
}
"""
✔ Then I expect the status code to be 200 # features/support/steps.js:91
✖ And the post with id "kljsdfg9843jknsdf" to be created # features/support/steps.js:113
Error: function timed out, ensure the promise resolves within 5000 milliseconds
at Timeout._time.default.setTimeout [as _onTimeout] (/home/robert/Development/human-connection/Human-Connection/backend/node_modules/cucumber/lib/user_code_runner.js:81:20)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)