remove testcase:test_signals_with_switch_sharding_db() and fix code style error for pull#1020

This commit is contained in:
Breeze.kay
2015-06-21 09:32:31 +08:00
parent dfc7f35ef1
commit 41bff0b293
3 changed files with 3 additions and 50 deletions

View File

@@ -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()