mongomock

Using a fake mongoDB for pytest testing

不羁岁月 提交于 2020-02-21 12:53:10
问题 I have code that connects to a MongoDB Client and I'm trying to test it. For testing, I don't want to connect to the actual client, so I'm trying to figure out make a fake one for testing purposes. The basic flow of the code is I have a function somewhere the creates a pymongo client, then queries that and makes a dict that is used elsewhere. I want to write some tests using pytest that will test different functions and classes that will call get_stuff . My problem is that get_stuff calls

Using a fake mongoDB for pytest testing

孤人 提交于 2020-02-21 12:51:49
问题 I have code that connects to a MongoDB Client and I'm trying to test it. For testing, I don't want to connect to the actual client, so I'm trying to figure out make a fake one for testing purposes. The basic flow of the code is I have a function somewhere the creates a pymongo client, then queries that and makes a dict that is used elsewhere. I want to write some tests using pytest that will test different functions and classes that will call get_stuff . My problem is that get_stuff calls

Using a fake mongoDB for pytest testing

非 Y 不嫁゛ 提交于 2020-02-21 12:51:33
问题 I have code that connects to a MongoDB Client and I'm trying to test it. For testing, I don't want to connect to the actual client, so I'm trying to figure out make a fake one for testing purposes. The basic flow of the code is I have a function somewhere the creates a pymongo client, then queries that and makes a dict that is used elsewhere. I want to write some tests using pytest that will test different functions and classes that will call get_stuff . My problem is that get_stuff calls