1
1
from werkzeug .exceptions import HTTPException
2
- import pymongo
3
2
4
3
from flask_pymongo .tests .util import FlaskPyMongoTest
5
4
@@ -14,10 +13,7 @@ def test_find_one_or_404(self):
14
13
except HTTPException as notfound :
15
14
assert notfound .code == 404 , "raised wrong exception"
16
15
17
- if pymongo .version_tuple [0 ] > 2 :
18
- self .mongo .db .things .insert_one ({"_id" : "thing" , "val" : "foo" })
19
- else :
20
- self .mongo .db .things .insert ({"_id" : "thing" , "val" : "foo" }, w = 1 )
16
+ self .mongo .db .things .insert_one ({"_id" : "thing" , "val" : "foo" })
21
17
22
18
# now it should not raise
23
19
thing = self .mongo .db .things .find_one_or_404 ({"_id" : "thing" })
@@ -30,11 +26,7 @@ def test_find_one_or_404(self):
30
26
except HTTPException as notfound :
31
27
assert notfound .code == 404 , "raised wrong exception"
32
28
33
- if pymongo .version_tuple [0 ] > 2 :
34
- # Write Concern is set to w=1 by default in pymongo > 3.0
35
- self .mongo .db .things .morethings .insert_one ({"_id" : "thing" , "val" : "foo" })
36
- else :
37
- self .mongo .db .things .morethings .insert ({"_id" : "thing" , "val" : "foo" }, w = 1 )
29
+ self .mongo .db .things .morethings .insert_one ({"_id" : "thing" , "val" : "foo" })
38
30
39
31
# now it should not raise
40
32
thing = self .mongo .db .things .morethings .find_one_or_404 ({"_id" : "thing" })
0 commit comments