-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(conf): ability to determine data folder (#91)
* Add mongod_data_folder to the execution context * Update README * Adding tests * fix mongod test Signed-off-by: Ertugrul Karademir <[email protected]> --------- Signed-off-by: Ertugrul Karademir <[email protected]>
- Loading branch information
1 parent
d20eba3
commit 8313537
Showing
4 changed files
with
90 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import subprocess | ||
|
||
from pymongo_inmemory.mongod import Mongod | ||
import pymongo_inmemory.downloader as downloader | ||
from pymongo_inmemory.context import Context | ||
|
||
|
||
class Popen: | ||
def __init__(self, cmd): | ||
self.cmd = cmd | ||
self.terminated = False | ||
|
||
def terminate(self): | ||
self.terminated = True | ||
|
||
def poll(self): | ||
return True | ||
|
||
|
||
def returns_true(): | ||
return True | ||
|
||
|
||
def download(): | ||
return "" | ||
|
||
|
||
def test_mongod(monkeypatch): | ||
monkeypatch.setattr(subprocess, "Popen", Popen) | ||
monkeypatch.setattr(Mongod, "is_healthy", returns_true) | ||
monkeypatch.setattr(downloader, "download", download) | ||
|
||
context = Context() | ||
context.mongod_data_folder = "TEST" | ||
|
||
with Mongod(context) as md: | ||
assert md.data_folder == "TEST" |