Skip to content

Commit

Permalink
Added a test for a lookup in Model.refresh_from_db(fields=[...]).
Browse files Browse the repository at this point in the history
  • Loading branch information
hramezani authored and timgraham committed Nov 15, 2018
1 parent e1fc07c commit cf915cb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/basic/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,12 @@ def test_unknown_kwarg(self):
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()
Expand Down

0 comments on commit cf915cb

Please sign in to comment.