diff --git a/suitcase/mongo_normalized/__init__.py b/suitcase/mongo_normalized/__init__.py index e7c1da8..d8d8a49 100644 --- a/suitcase/mongo_normalized/__init__.py +++ b/suitcase/mongo_normalized/__init__.py @@ -209,10 +209,10 @@ def update(self, name, doc): if field in old and field in doc: if old[field] != doc[field]: # Allow the removal of restricted fields, but not update - if doc[field] != None: + if doc[field] is not None: raise ValueError( - f"Field '{field}' is restricted and cannot be changed." - ) + f"Field '{field}' is restricted and cannot be changed." + ) target_uid_docs = revisions_col.find({"document.uid": doc["uid"]}) cur = target_uid_docs.sort([("revision", pymongo.DESCENDING)]).limit(1) wrapped = dict() diff --git a/suitcase/mongo_normalized/tests/fixtures.py b/suitcase/mongo_normalized/tests/fixtures.py index 7c77189..521c82f 100644 --- a/suitcase/mongo_normalized/tests/fixtures.py +++ b/suitcase/mongo_normalized/tests/fixtures.py @@ -2,7 +2,6 @@ # intake-bluesky-mongo) to import and reuse this fixtures without importing # *all* the fixtures used in conftest and the dependencies that they carry. import mongomock -import pymongo import pytest import uuid @@ -11,12 +10,12 @@ def db_factory(request): def inner(): database_name = f'test-{str(uuid.uuid4())}' - uri = 'mongodb://dbroker:secret@localhost:27017/test_database?authSource=admin' - client = pymongo.MongoClient(uri, False) + uri = 'mongodb://localhost:27017/' + client = mongomock.MongoClient(uri) def drop(): client.drop_database(database_name) request.addfinalizer(drop) return client[database_name] - return inner + return inner \ No newline at end of file