File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99def mongomv_client ():
1010 cl = MongoMVClient (uri = TEST_MONGO_URI )
1111 yield cl
12+
13+
14+ @pytest .fixture (scope = "module" )
15+ def model ():
16+ client = MongoMVClient (uri = TEST_MONGO_URI )
17+ md = client .create_model (name = "test_model" , tags = ["testing" , "pytest" ])
18+ yield md
19+ md .delete ()
Original file line number Diff line number Diff line change 1+ import os
2+ from pathlib import Path
3+ from mongomv .schemas import ModelEntity
4+ import pytest
5+
6+
7+ @pytest .mark .usefixtures ("model" )
8+ class TestGridFS :
9+
10+ def test_dump_model (self , model : ModelEntity ):
11+ path = Path (os .getcwd ()).joinpath ("text.txt" )
12+ with open (path , "w" ) as file :
13+ file .write ("This is test case for GridFS" )
14+ result = model .dump_model (model_path = path , filename = "text.txt" )
15+ assert type (result ) == str
16+ assert model .serialized_model is not None
17+ os .remove (path = path )
18+
19+
20+ def test_load_model (self , model : ModelEntity ):
21+ path = Path (os .getcwd ()).joinpath ("text.txt" )
22+ result = model .load_model (model_path = path )
23+ assert type (result ) == str
24+ assert path .exists ()
25+ os .remove (path = path )
26+
27+
28+ def test_delete_serialized_model (self , model : ModelEntity ):
29+ result = model .delete_model ()
30+ assert type (result ) == str
You can’t perform that action at this time.
0 commit comments