MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / test_gridfs_secondary

Method test_gridfs_secondary

test/test_gridfs.py:560–572  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

558 self.assertEqual(b"foo", content)
559
560 def test_gridfs_secondary(self):
561 secondary_host, secondary_port = one(self.client.secondaries)
562 secondary_connection = self.single_client(
563 secondary_host, secondary_port, read_preference=ReadPreference.SECONDARY
564 )
565
566 # Should detect it's connected to secondary and not attempt to
567 # create index
568 fs = gridfs.GridFS(secondary_connection.gfsreplica, "gfssecondarytest")
569
570 # This won't detect secondary, raises error
571 with self.assertRaises(NotPrimaryError):
572 fs.put(b"foo")
573
574 def test_gridfs_secondary_lazy(self):
575 # Should detect it's connected to secondary and not attempt to

Callers

nothing calls this directly

Calls 3

putMethod · 0.95
oneFunction · 0.90
single_clientMethod · 0.80

Tested by

no test coverage detected