summaryrefslogtreecommitdiff
path: root/tests/basic
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2018-11-15 17:38:47 +0100
committerTim Graham <timograham@gmail.com>2018-11-15 11:38:47 -0500
commitcf915cb5138e0b245393429e141cb741a390a095 (patch)
tree96423cf04505ce7f64033d546cb24f45a3d17a94 /tests/basic
parente1fc07c047f8e46c2cea0120f44011fc458f1e91 (diff)
downloaddjango-cf915cb5138e0b245393429e141cb741a390a095.tar.gz
Added a test for a lookup in Model.refresh_from_db(fields=[...]).
Diffstat (limited to 'tests/basic')
-rw-r--r--tests/basic/tests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/basic/tests.py b/tests/basic/tests.py
index 342c39ea34..b3bb4d02cc 100644
--- a/tests/basic/tests.py
+++ b/tests/basic/tests.py
@@ -649,6 +649,12 @@ class ModelRefreshTests(TestCase):
with self.assertRaisesMessage(TypeError, msg):
s.refresh_from_db(unknown_kwarg=10)
+ def test_lookup_in_fields(self):
+ s = SelfRef.objects.create()
+ msg = 'Found "__" in fields argument. Relations and transforms are not allowed in fields.'
+ with self.assertRaisesMessage(ValueError, msg):
+ s.refresh_from_db(fields=['foo__bar'])
+
def test_refresh_fk(self):
s1 = SelfRef.objects.create()
s2 = SelfRef.objects.create()