Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
For Py27 compact
  • Loading branch information
davidlatwe committed Aug 3, 2019
1 parent 60f45eb commit 40dc078
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
MontyList,
)

from bson import BSON
from bson import BSON, json_util
from bson.timestamp import Timestamp
from bson.objectid import ObjectId
from bson.min_key import MinKey
Expand Down Expand Up @@ -68,7 +68,7 @@
AF5iAAAAJwAAABBfaWQACAAAAA9hABYAAAACAAAAeAAMAAAAEG0AAAAAAAAAEQAAABBfaWQACQAA
AP9hAAARAAAAEF9pZAAKAAAAf2EAABkAAAAQX2lkAAsAAAARYQABAAAAAAAAAAAdAAAAEF9pZAAM
AAAAB2EAMDAwMDAwMDAwMDAwAA==
""".lstrip()
""".replace(b"\n", b"")


JSON_DUMP = "dumped.json"
Expand Down Expand Up @@ -104,7 +104,8 @@ def test_utils_montyexport(tmp_monty_repo):

with open(JSON_DUMP, "r") as dump:
data = dump.read().strip()
assert data == SERIALIZED
for d, s in zip(data.split("\n"), SERIALIZED.split("\n")):
assert json_util.loads(d) == json_util.loads(s)

os.remove(JSON_DUMP)

Expand All @@ -118,7 +119,7 @@ def test_utils_montyrestore(tmp_monty_repo):

with open_repo(tmp_monty_repo):
with open(BSON_DUMP, "wb") as dump:
dump.write(base64.decodebytes(BINARY))
dump.write(base64.b64decode(BINARY))

montyrestore(database, collection, BSON_DUMP)

Expand All @@ -138,7 +139,7 @@ def test_utils_montydump(tmp_monty_repo):

with open(BSON_DUMP, "rb") as dump:
raw = dump.read()
assert base64.encodebytes(raw) == BINARY
assert base64.b64encode(raw) == BINARY


def test_MongoQueryRecorder(mongo_client):
Expand Down

0 comments on commit 40dc078

Please sign in to comment.