-
-
Notifications
You must be signed in to change notification settings - Fork 480
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more tests to ensure that queries on historical models in separate db…
…s are still possible
- Loading branch information
1 parent
4125522
commit 6f116c7
Showing
1 changed file
with
10 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1493,10 +1493,15 @@ def setUp(self): | |
self.user = get_user_model().objects.create( | ||
username="username", email="[email protected]", password="top_secret" | ||
) | ||
self.model_ = ModelWithHistoryInDifferentDb(name="test") | ||
|
||
def tearDown(self): | ||
self.model_ = None | ||
|
||
def test_using_separate_db(self): | ||
self.assertEqual("other", self.model_.history.db) | ||
self.model_ = ModelWithHistoryInDifferentDb(name="test") | ||
self.model_.save() | ||
self.assertEqual("other", self.model_.history.using('other').db) | ||
self.assertEqual(1, self.model_.history.using('other').count()) | ||
self.assertEqual("+", self.model_.history.using('other').first().history_type) | ||
self.model_.name = "test1" | ||
self.model_.save() | ||
self.assertEqual("other", self.model_.history.using('other').db) | ||
self.assertEqual(2, self.model_.history.using('other').count()) | ||
self.assertEqual("~", self.model_.history.using('other').first().history_type) |