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):
30
30
gridfs = GridFS (self .mongo .db )
31
31
assert gridfs .exists ({"filename" : "my-file" })
32
32
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
+
33
41
def test_it_saves_files_with_props (self ):
34
42
fileobj = BytesIO (b"these are the bytes" )
35
43
@@ -65,6 +73,10 @@ def test_it_sets_content_type(self):
65
73
resp = self .mongo .send_file ("myfile.txt" )
66
74
assert resp .content_type .startswith ("text/plain" )
67
75
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
+
68
80
def test_it_sets_content_length (self ):
69
81
resp = self .mongo .send_file ("myfile.txt" )
70
82
assert resp .content_length == len (self .myfile .getvalue ())
You can’t perform that action at this time.
0 commit comments