def test_allow_syncdb_setting(self):
     router = MasterSlaveRouter()
     load_setting('MASTER_DB_ALLOW_SYNC', True)
     assert router.allow_syncdb(MASTER_DATABASE, None)
     load_setting('MASTER_DB_ALLOW_SYNC', False)
     assert not router.allow_syncdb(MASTER_DATABASE, None)
     clear_setting('MASTER_DB_ALLOW_SYNC')
 def test_allow_syncdb(self):
     """Make sure allow_syncdb() does the right thing for both masters and
     slaves"""
     router = MasterSlaveRouter()
     assert router.allow_syncdb(DEFAULT_DB_ALIAS, None)
     assert not router.allow_syncdb(get_slave(), None)
Exemple #3
0
 def test_allow_migrate(self):
     """Make sure allow_migrate() does the right thing for both masters and
     slaves"""
     router = MasterSlaveRouter()
     assert router.allow_migrate(DEFAULT_DB_ALIAS, None, None)
     assert not router.allow_migrate(get_slave(), None, None)
Exemple #4
0
 def test_db_for_write(self):
     eq_(MasterSlaveRouter().db_for_write(None), DEFAULT_DB_ALIAS)
Exemple #5
0
 def test_db_for_read(self):
     eq_(MasterSlaveRouter().db_for_read(None), get_slave())
 def test_allow_migrate(self):
     """Make sure allow_migrate() does the right thing for both masters and
     slaves"""
     router = MasterSlaveRouter()
     assert router.allow_migrate(DEFAULT_DB_ALIAS, 'dummy')
     assert not router.allow_migrate(get_slave(), 'dummy')
 def test_allow_syncdb(self):
     """Make sure allow_syncdb() does the right thing for both masters and slaves"""
     router = MasterSlaveRouter()
     assert router.allow_syncdb(MASTER_DATABASE, None)
     assert router.allow_syncdb(get_slave(), None) == False
     assert router.allow_syncdb('other', None) == None