|
@@ -135,9 +135,14 @@ class OneToOneTests(TestCase):
|
|
|
should raise an exception.
|
|
|
"""
|
|
|
place = Place(name='User', address='London')
|
|
|
+ with self.assertRaises(Restaurant.DoesNotExist):
|
|
|
+ place.restaurant
|
|
|
msg = "save() prohibited to prevent data loss due to unsaved related object 'place'."
|
|
|
with self.assertRaisesMessage(ValueError, msg):
|
|
|
Restaurant.objects.create(place=place, serves_hot_dogs=True, serves_pizza=False)
|
|
|
+ # place should not cache restaurant
|
|
|
+ with self.assertRaises(Restaurant.DoesNotExist):
|
|
|
+ place.restaurant
|
|
|
|
|
|
def test_reverse_relationship_cache_cascade(self):
|
|
|
"""
|