K
K
keddad2020-05-09 00:27:36
Python
keddad, 2020-05-09 00:27:36

Are there ready-made mocks for testing the database?

Faced a problem. I wanted to write unit tests for my service, I decided to mock the database. Some things (for example, Redis via aioredis) can still be manually locked (they are small, I use a dozen commands, it's easy to implement), but writing a mock for Mongodb via Motor, so that it would support GridFS (well, its methods) - that's another quest. Are there ready-made class implementations for database mocking?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2020-05-09
@keddad

Why wet the base? Raise the test base during tests, delete it after the tests.
Or mock the repository.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question