Skip to content

Commit f09256a

Browse files
Erdenezul BatmunkhErdenezul Batmunkh
authored andcommitted
Fix modify tests #1565
1 parent 34fca9d commit f09256a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/queryset/modify.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,26 +103,26 @@ class BlogPost(Document):
103103

104104
BlogPost.drop_collection()
105105

106-
BlogPost(id="ABC").save()
106+
blog = BlogPost.objects.create()
107107

108108
# Push a new tag via modify with new=False (default).
109-
blog = BlogPost(pk='ABC').modify(push__tags='code')
109+
BlogPost(id=blog.id).modify(push__tags='code')
110110
self.assertEqual(blog.tags, [])
111111
blog.reload()
112112
self.assertEqual(blog.tags, ['code'])
113113

114114
# Push a new tag via modify with new=True.
115-
blog = BlogPost.objects(pk='ABC').modify(push__tags='java', new=True)
115+
blog = BlogPost.objects(id=blog.id).modify(push__tags='java', new=True)
116116
self.assertEqual(blog.tags, ['code', 'java'])
117117

118118
# Push a new tag with a positional argument.
119-
blog = BlogPost.objects(pk='ABC').modify(
119+
blog = BlogPost.objects(id=blog.id).modify(
120120
push__tags__0='python',
121121
new=True)
122122
self.assertEqual(blog.tags, ['python', 'code', 'java'])
123123

124124
# Push multiple new tags with a positional argument.
125-
blog = BlogPost.objects(pk='ABC').modify(
125+
blog = BlogPost.objects(id=blog.id).modify(
126126
push__tags__1=['go', 'rust'],
127127
new=True)
128128
self.assertEqual(blog.tags, ['python', 'go', 'rust', 'code', 'java'])

0 commit comments

Comments
 (0)