Skip to content

Commit

Permalink
Adjust num queries
Browse files Browse the repository at this point in the history
  • Loading branch information
hipek8 committed May 16, 2024
1 parent 1112b75 commit d5d2ea0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/ralph/data_center/tests/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DataCenterAssetViewTest(ClientMixin, TestCase):
def test_changelist_view(self):
self.login_as_user()
DataCenterAssetFullFactory.create_batch(10)
with self.assertNumQueries(20):
with self.assertNumQueries(21):
self.client.get(
reverse('admin:data_center_datacenterasset_changelist'),
)
Expand All @@ -54,7 +54,7 @@ def test_changelist_view(self):
VirtualServerFullFactory.create_batch(5)
CloudHostFullFactory.create_batch(4)
ClusterFactory.create_batch(4)
with self.assertNumQueries(21):
with self.assertNumQueries(22):
result = self.client.get(
reverse('admin:data_center_dchost_changelist'),
)
Expand Down
8 changes: 4 additions & 4 deletions src/ralph/data_importer/tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_users_through_field(self):
self.assertEqual(self.licence2.users.all().count(), 3)

# Add and remove
with self.assertNumQueries(4):
with self.assertNumQueries(5):
field.save(
self.licence,
{'users': ','.join([i.username for i in self.users])}
Expand All @@ -88,7 +88,7 @@ def test_users_through_field(self):
self.assertEqual(self.licence.users.all().count(), 5)

# Remove
with self.assertNumQueries(3):
with self.assertNumQueries(4):
field.save(
self.licence,
{'users': ','.join([i.username for i in users[:4]])}
Expand Down Expand Up @@ -143,7 +143,7 @@ def test_through_field_only_remove(self):
field = self._get_base_objects_through_field()
self.assertEqual(self.licence.base_objects.all().count(), 2)
ids = [self.back_office_assets[0].pk]
with self.assertNumQueries(3):
with self.assertNumQueries(4):
field.save(
self.licence,
{'base_objects': ','.join(map(str, ids))}
Expand All @@ -165,7 +165,7 @@ def test_through_field_add_and_remove(self):
self.back_office_assets[3].pk,

]
with self.assertNumQueries(4):
with self.assertNumQueries(5):
field.save(
self.licence,
{'base_objects': ','.join(map(str, ids))}
Expand Down
3 changes: 2 additions & 1 deletion src/ralph/lib/mixins/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from djmoney.models.fields import MoneyField
from taggit.managers import TaggableManager as TaggableManagerOriginal, _TaggableManager
from taggit.managers import TaggableManager as TaggableManagerOriginal
from taggit.managers import _TaggableManager # noqa

from ralph.lib.mixins.fields import TaggitTagField
from ralph.settings import DEFAULT_CURRENCY_CODE
Expand Down

0 comments on commit d5d2ea0

Please sign in to comment.