remove testcase:test_signals_with_switch_sharding_db() and fix code style error for pull#1020
This commit is contained in:
parent
dfc7f35ef1
commit
41bff0b293
@ -5,7 +5,7 @@ Changelog
|
||||
|
||||
Changes in 0.9.X - DEV
|
||||
======================
|
||||
- improve Document._created status when switch collection and db #1020
|
||||
- Improve Document._created status when switch collection and db #1020
|
||||
- Queryset update doesn't go through field validation #453
|
||||
- Added support for specifying authentication source as option `authSource` in URI. #967
|
||||
- Fixed mark_as_changed to handle higher/lower level fields changed. #927
|
||||
|
@ -503,8 +503,7 @@ class Document(BaseDocument):
|
||||
|
||||
:param str db_alias: The database alias to use for saving the document
|
||||
|
||||
:param bool keep_created: keep self._created value after call `swith_db()` when True,
|
||||
else will always set self._created value to True
|
||||
:param bool keep_created: keep self._created value after switching db, else is reset to True
|
||||
|
||||
|
||||
.. seealso::
|
||||
@ -535,8 +534,7 @@ class Document(BaseDocument):
|
||||
:param str collection_name: The database alias to use for saving the
|
||||
document
|
||||
|
||||
:param bool keep_created: keep self._created value after call `swith_db()` when True,
|
||||
else will always set self._created value to True
|
||||
:param bool keep_created: keep self._created value after switching collection, else is reset to True
|
||||
|
||||
|
||||
.. seealso::
|
||||
|
@ -306,51 +306,6 @@ class SignalTests(unittest.TestCase):
|
||||
ei.switch_db("testdb-1", keep_created=False)
|
||||
self.assertEqual(self.get_signal_output(ei.save), ['Is created'])
|
||||
|
||||
def test_signals_with_switch_sharding_db(self):
|
||||
|
||||
import pymongo
|
||||
from mongoengine.connection import get_connection
|
||||
|
||||
connect('mongoenginetest', alias='testdb1')
|
||||
expected_connection = get_connection('testdb1')
|
||||
|
||||
connect('mongoenginetest', alias='testdb2')
|
||||
actual_connection = get_connection('testdb2')
|
||||
|
||||
if pymongo.version_tuple[0] < 3:
|
||||
IS_PYMONGO_3 = False
|
||||
else:
|
||||
IS_PYMONGO_3 = True
|
||||
|
||||
ei = self.ExplicitId(id=123)
|
||||
ei.switch_db("testdb1")
|
||||
self.assertEqual(self.get_signal_output(ei.save), ['Is created'])
|
||||
ei.switch_db("testdb1")
|
||||
self.assertEqual(self.get_signal_output(ei.save), ['Is updated'])
|
||||
|
||||
ei.switch_db("testdb2", keep_created=False)
|
||||
self.assertEqual(self.get_signal_output(ei.save), ['Is created'])
|
||||
ei.switch_db("testdb2", keep_created=False)
|
||||
self.assertEqual(self.get_signal_output(ei.save), ['Is created'])
|
||||
|
||||
# Handle PyMongo 3+ Async Connection
|
||||
if IS_PYMONGO_3:
|
||||
# Ensure we are connected, throws ServerSelectionTimeoutError otherwise.
|
||||
# Purposely not catching exception to fail test if thrown.
|
||||
expected_connection.server_info()
|
||||
|
||||
self.assertEqual(expected_connection, actual_connection)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user