Skip to content

Commit ec32d52

Browse files
committed
Feedback updates in test cases
1 parent e42841a commit ec32d52

File tree

1 file changed

+31
-15
lines changed

1 file changed

+31
-15
lines changed

tests/test_django_async_orm.py

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,25 @@ async def test_async_get(self):
3232
result = await TestModel.objects.async_get(name="setup 1")
3333
self.assertEqual(result.name, "setup 1")
3434

35+
@tag('ci')
36+
async def test_async_create(self):
37+
result = await TestModel.objects.async_create(name="test")
38+
self.assertEqual(result.name, 'test')
39+
40+
@tag('ci')
41+
async def test_async_bulk_create(self):
42+
objs = await TestModel.objects.async_bulk_create([
43+
TestModel(name='bulk create 1'),
44+
TestModel(name='bulk create 2'),
45+
])
46+
objs = await TestModel.objects.async_all()
47+
objs = await objs.async_count()
48+
self.assertEqual(objs, 4)
49+
50+
@tag('dev')
51+
async def test_async_bulk_update(self):
52+
self.assertTrue(False, "Not Implemented")
53+
3554
@tag('ci')
3655
async def test_async_get_or_create(self):
3756

@@ -88,7 +107,7 @@ async def test_async_delete(self):
88107

89108
await all_created.async_delete()
90109
all_after_delete = await TestModel.objects.async_all()
91-
count = await all_created.async_count()
110+
count = await all_after_delete.async_count()
92111
self.assertEqual(count, 0)
93112

94113
@tag('ci')
@@ -186,21 +205,18 @@ async def test_async_annotate(self):
186205
self.assertTrue(False, "Not Implemented")
187206

188207
@tag('ci')
189-
async def test_async_order_by(self):
190-
async def test_async_order_by_ascending(self):
191-
qs = await TestModel.objects.async_all()
192-
qs = await qs.async_order_by('name')
193-
qs = await qs.async_first()
194-
self.assertEqual(qs.name, "setup 1")
208+
async def test_async_order_by_ascending(self):
209+
qs = await TestModel.objects.async_all()
210+
qs = await qs.async_order_by('name')
211+
qs = await qs.async_first()
212+
self.assertEqual(qs.name, "setup 1")
195213

196-
async def test_async_order_by_descending(self):
197-
qs = await TestModel.objects.async_all()
198-
qs = await qs.async_order_by('-name')
199-
qs = await qs.async_first()
200-
self.assertEqual(qs.name, "setup 2")
201-
202-
await test_async_order_by_ascending(self)
203-
await test_async_order_by_descending(self)
214+
@tag('ci')
215+
async def test_async_order_by_descending(self):
216+
qs = await TestModel.objects.async_all()
217+
qs = await qs.async_order_by('-name')
218+
qs = await qs.async_first()
219+
self.assertEqual(qs.name, "setup 2")
204220

205221
@tag('dev')
206222
async def test_async_distinct(self):

0 commit comments

Comments
 (0)