diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2018-09-18 21:58:20 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-09-18 15:58:20 -0400 |
| commit | 7b159df94235036a41ee93952ff83bbc95c1da3c (patch) | |
| tree | c46b491c1351593c7bb9293a72752f35db176899 | |
| parent | 0192e9a976ea7018220ec607de63a641323404b1 (diff) | |
Fixed expressions tests when run in reverse.
Regression in e7a0a5c8b21f5ad1a0066bd0dfab84466b474e15.
| -rw-r--r-- | tests/expressions/tests.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py index c74ff8f30d..c631151448 100644 --- a/tests/expressions/tests.py +++ b/tests/expressions/tests.py @@ -273,18 +273,17 @@ class BasicExpressionsTests(TestCase): def test_object_update_fk(self): # F expressions cannot be used to update attributes which are foreign # keys, or attributes which involve joins. - def test(): - self.gmbh.point_of_contact = F('ceo') + test_gmbh = Company.objects.get(pk=self.gmbh.pk) msg = 'F(ceo)": "Company.point_of_contact" must be a "Employee" instance.' with self.assertRaisesMessage(ValueError, msg): - test() + test_gmbh.point_of_contact = F('ceo') - self.gmbh.point_of_contact = self.gmbh.ceo - self.gmbh.save() - self.gmbh.name = F('ceo__last_name') + test_gmbh.point_of_contact = self.gmbh.ceo + test_gmbh.save() + test_gmbh.name = F('ceo__last_name') msg = 'Joined field references are not permitted in this query' with self.assertRaisesMessage(FieldError, msg): - self.gmbh.save() + test_gmbh.save() def test_object_update_unsaved_objects(self): # F expressions cannot be used to update attributes on objects which do |
