-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
target: v3Documentation PRs/issues targeting content from docs-v3.strapi.io (v3 branch)Documentation PRs/issues targeting content from docs-v3.strapi.io (v3 branch)
Description
Bug report
Describe the bug
I was following the strapi testing documentation when this arose.
I was trying to test a strapi endpoint and inserting user data into the db when it can gave an error that data could not be inserted into read-only db
I have just copied this test - https://strapi.io/documentation/developer-docs/latest/guides/unit-testing.html#testing-auth-endpoint-controller
const userData = {
username: 'tester',
email: 'tester@strapi.com',
provider: 'local',
password: '1234abc',
confirmed: true,
blocked: null,
};
beforeEach(async () => {
await strapi.plugins['users-permissions'].services.user.add({
...userData,
});
});The error was this
"before each" hook for "blank request does not give 2xx status code":
insert into `users-permissions_user` (`blocked`, `confirmed`, `created_at`, `email`, `password`, `provider`, `updated_at`, `username`) values (NULL, true, '2021-01-10 20:15:14.452', 'testing@strapi.app', '$2a$10$o/DBLodkVtamQOK.4HHm3Opi6lkB33EVOzswaVOsipEfwtByNaOGW', 'local', '2021-01-10 20:15:14.452', 'tester') - SQLITE_READONLY: attempt to write a readonly database
Error: SQLITE_READONLY: attempt to write a readonly database
Steps to reproduce the behavior
Follow the testing documentation - https://strapi.io/documentation/developer-docs/latest/guides/unit-testing.html
Expected behavior
Data to be inserted in the db.
Screenshots
Code snippets
My test config for the db is this:
{
defaultConnection: 'default',
connections: {
default: {
connector: 'bookshelf',
settings: {
client: 'postgres',
database: dbConfig.database,
host: dbConfig.host,
port: dbConfig.port,
username: dbConfig.user,
password: dbConfig.password,
ssl: {
rejectUnauthorized: false,
},
},
options: {
ssl: true,
},
},
},
};System
- Node.js version: 12.20.1
- NPM version: 6.14.10
- Strapi version: 3.4.1
- Database: SQLite3
- Operating system: Ubuntu 20.04
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
target: v3Documentation PRs/issues targeting content from docs-v3.strapi.io (v3 branch)Documentation PRs/issues targeting content from docs-v3.strapi.io (v3 branch)
