File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,14 @@ def test_it_saves_files(self):
3030 gridfs = GridFS (self .mongo .db )
3131 assert gridfs .exists ({"filename" : "my-file" })
3232
33+ def test_it_saves_files_to_another_db (self ):
34+ fileobj = BytesIO (b"these are the bytes" )
35+
36+ self .mongo .save_file ("my-file" , fileobj , db = "other" )
37+ assert self .mongo .db is not None
38+ gridfs = GridFS (self .mongo .db )
39+ assert gridfs .exists ({"filename" : "my-file" })
40+
3341 def test_it_saves_files_with_props (self ):
3442 fileobj = BytesIO (b"these are the bytes" )
3543
@@ -65,6 +73,10 @@ def test_it_sets_content_type(self):
6573 resp = self .mongo .send_file ("myfile.txt" )
6674 assert resp .content_type .startswith ("text/plain" )
6775
76+ def test_it_sends_file_to_another_db (self ):
77+ resp = self .mongo .send_file ("myfile.txt" , db = "other" )
78+ assert resp .content_type .startswith ("text/plain" )
79+
6880 def test_it_sets_content_length (self ):
6981 resp = self .mongo .send_file ("myfile.txt" )
7082 assert resp .content_length == len (self .myfile .getvalue ())
You can’t perform that action at this time.
0 commit comments