mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #22667 -- Replaced leader/follower terminology with primary/replica
This commit is contained in:
committed by
Tim Graham
parent
ad994a3c5b
commit
beec05686c
@@ -854,7 +854,7 @@ class QueryTestCase(TestCase):
|
||||
self.assertEqual(book.editor._state.db, 'other')
|
||||
|
||||
def test_subquery(self):
|
||||
"""Make sure as_sql works with subqueries and leader/follower."""
|
||||
"""Make sure as_sql works with subqueries and primary/replica."""
|
||||
sub = Person.objects.using('other').filter(name='fff')
|
||||
qs = Book.objects.filter(editor__in=sub)
|
||||
|
||||
@@ -919,7 +919,7 @@ class RouterTestCase(TestCase):
|
||||
multi_db = True
|
||||
|
||||
def setUp(self):
|
||||
# Make the 'other' database appear to be a follower of the 'default'
|
||||
# Make the 'other' database appear to be a replica of the 'default'
|
||||
self.old_routers = router.routers
|
||||
router.routers = [TestRouter()]
|
||||
|
||||
@@ -1071,7 +1071,7 @@ class RouterTestCase(TestCase):
|
||||
try:
|
||||
dive.editor = marty
|
||||
except ValueError:
|
||||
self.fail("Assignment across leader/follower databases with a common source should be ok")
|
||||
self.fail("Assignment across primary/replica databases with a common source should be ok")
|
||||
|
||||
# Database assignments of original objects haven't changed...
|
||||
self.assertEqual(marty._state.db, 'default')
|
||||
@@ -1089,7 +1089,7 @@ class RouterTestCase(TestCase):
|
||||
except Book.DoesNotExist:
|
||||
self.fail('Source database should have a copy of saved object')
|
||||
|
||||
# This isn't a real leader-follower database, so restore the original from other
|
||||
# This isn't a real primary/replica database, so restore the original from other
|
||||
dive = Book.objects.using('other').get(title='Dive into Python')
|
||||
self.assertEqual(dive._state.db, 'other')
|
||||
|
||||
@@ -1097,7 +1097,7 @@ class RouterTestCase(TestCase):
|
||||
try:
|
||||
marty.edited = [pro, dive]
|
||||
except ValueError:
|
||||
self.fail("Assignment across leader/follower databases with a common source should be ok")
|
||||
self.fail("Assignment across primary/replica databases with a common source should be ok")
|
||||
|
||||
# Assignment implies a save, so database assignments of original objects have changed...
|
||||
self.assertEqual(marty._state.db, 'default')
|
||||
@@ -1111,7 +1111,7 @@ class RouterTestCase(TestCase):
|
||||
except Book.DoesNotExist:
|
||||
self.fail('Source database should have a copy of saved object')
|
||||
|
||||
# This isn't a real leader-follower database, so restore the original from other
|
||||
# This isn't a real primary/replica database, so restore the original from other
|
||||
dive = Book.objects.using('other').get(title='Dive into Python')
|
||||
self.assertEqual(dive._state.db, 'other')
|
||||
|
||||
@@ -1119,7 +1119,7 @@ class RouterTestCase(TestCase):
|
||||
try:
|
||||
marty.edited.add(dive)
|
||||
except ValueError:
|
||||
self.fail("Assignment across leader/follower databases with a common source should be ok")
|
||||
self.fail("Assignment across primary/replica databases with a common source should be ok")
|
||||
|
||||
# Add implies a save, so database assignments of original objects have changed...
|
||||
self.assertEqual(marty._state.db, 'default')
|
||||
@@ -1133,7 +1133,7 @@ class RouterTestCase(TestCase):
|
||||
except Book.DoesNotExist:
|
||||
self.fail('Source database should have a copy of saved object')
|
||||
|
||||
# This isn't a real leader-follower database, so restore the original from other
|
||||
# This isn't a real primary/replica database, so restore the original from other
|
||||
dive = Book.objects.using('other').get(title='Dive into Python')
|
||||
|
||||
# If you assign a FK object when the base object hasn't
|
||||
@@ -1196,7 +1196,7 @@ class RouterTestCase(TestCase):
|
||||
mark = Person.objects.using('default').create(pk=2, name="Mark Pilgrim")
|
||||
|
||||
# Now save back onto the usual database.
|
||||
# This simulates leader/follower - the objects exist on both database,
|
||||
# This simulates primary/replica - the objects exist on both database,
|
||||
# but the _state.db is as it is for all other tests.
|
||||
pro.save(using='default')
|
||||
marty.save(using='default')
|
||||
@@ -1213,7 +1213,7 @@ class RouterTestCase(TestCase):
|
||||
try:
|
||||
marty.book_set = [pro, dive]
|
||||
except ValueError:
|
||||
self.fail("Assignment across leader/follower databases with a common source should be ok")
|
||||
self.fail("Assignment across primary/replica databases with a common source should be ok")
|
||||
|
||||
# Database assignments don't change
|
||||
self.assertEqual(marty._state.db, 'default')
|
||||
@@ -1232,7 +1232,7 @@ class RouterTestCase(TestCase):
|
||||
try:
|
||||
marty.book_set.add(dive)
|
||||
except ValueError:
|
||||
self.fail("Assignment across leader/follower databases with a common source should be ok")
|
||||
self.fail("Assignment across primary/replica databases with a common source should be ok")
|
||||
|
||||
# Database assignments don't change
|
||||
self.assertEqual(marty._state.db, 'default')
|
||||
@@ -1251,7 +1251,7 @@ class RouterTestCase(TestCase):
|
||||
try:
|
||||
dive.authors = [mark, marty]
|
||||
except ValueError:
|
||||
self.fail("Assignment across leader/follower databases with a common source should be ok")
|
||||
self.fail("Assignment across primary/replica databases with a common source should be ok")
|
||||
|
||||
# Database assignments don't change
|
||||
self.assertEqual(marty._state.db, 'default')
|
||||
@@ -1273,7 +1273,7 @@ class RouterTestCase(TestCase):
|
||||
try:
|
||||
dive.authors.add(marty)
|
||||
except ValueError:
|
||||
self.fail("Assignment across leader/follower databases with a common source should be ok")
|
||||
self.fail("Assignment across primary/replica databases with a common source should be ok")
|
||||
|
||||
# Database assignments don't change
|
||||
self.assertEqual(marty._state.db, 'default')
|
||||
@@ -1311,7 +1311,7 @@ class RouterTestCase(TestCase):
|
||||
try:
|
||||
bob.userprofile = alice_profile
|
||||
except ValueError:
|
||||
self.fail("Assignment across leader/follower databases with a common source should be ok")
|
||||
self.fail("Assignment across primary/replica databases with a common source should be ok")
|
||||
|
||||
# Database assignments of original objects haven't changed...
|
||||
self.assertEqual(alice._state.db, 'default')
|
||||
@@ -1342,7 +1342,7 @@ class RouterTestCase(TestCase):
|
||||
try:
|
||||
review1.content_object = dive
|
||||
except ValueError:
|
||||
self.fail("Assignment across leader/follower databases with a common source should be ok")
|
||||
self.fail("Assignment across primary/replica databases with a common source should be ok")
|
||||
|
||||
# Database assignments of original objects haven't changed...
|
||||
self.assertEqual(pro._state.db, 'default')
|
||||
@@ -1361,7 +1361,7 @@ class RouterTestCase(TestCase):
|
||||
except Book.DoesNotExist:
|
||||
self.fail('Source database should have a copy of saved object')
|
||||
|
||||
# This isn't a real leader-follower database, so restore the original from other
|
||||
# This isn't a real primary/replica database, so restore the original from other
|
||||
dive = Book.objects.using('other').get(title='Dive into Python')
|
||||
self.assertEqual(dive._state.db, 'other')
|
||||
|
||||
@@ -1369,7 +1369,7 @@ class RouterTestCase(TestCase):
|
||||
try:
|
||||
dive.reviews.add(review1)
|
||||
except ValueError:
|
||||
self.fail("Assignment across leader/follower databases with a common source should be ok")
|
||||
self.fail("Assignment across primary/replica databases with a common source should be ok")
|
||||
|
||||
# Database assignments of original objects haven't changed...
|
||||
self.assertEqual(pro._state.db, 'default')
|
||||
@@ -1444,7 +1444,7 @@ class RouterTestCase(TestCase):
|
||||
self.assertEqual(pro.reviews.db_manager('default').all().db, 'default')
|
||||
|
||||
def test_subquery(self):
|
||||
"""Make sure as_sql works with subqueries and leader/follower."""
|
||||
"""Make sure as_sql works with subqueries and primary/replica."""
|
||||
# Create a book and author on the other database
|
||||
|
||||
mark = Person.objects.using('other').create(name="Mark Pilgrim")
|
||||
@@ -1482,7 +1482,7 @@ class AuthTestCase(TestCase):
|
||||
multi_db = True
|
||||
|
||||
def setUp(self):
|
||||
# Make the 'other' database appear to be a follower of the 'default'
|
||||
# Make the 'other' database appear to be a replica of the 'default'
|
||||
self.old_routers = router.routers
|
||||
router.routers = [AuthRouter()]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user