1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00

test: classes that use no database are SimpleTestCase

Ten classes ran on TestCase or TransactionTestCase although they read
files, templates or scripts only. SimpleTestCase skips the transaction
and refuses a database query, so a test that starts to use the database
says so. LoggingConfigTestCase also removes the temporary directory it
makes.
This commit is contained in:
catborise 2026-11-06 11:17:59 +03:00
parent ee6b8d3e10
commit 03811cc4ab
6 changed files with 17 additions and 15 deletions

View file

@ -5,7 +5,7 @@ from unittest.mock import MagicMock, patch
from computes.models import Compute
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.test import SimpleTestCase, TestCase
from django.urls import reverse
from instances.api.serializers import CreateInstanceSerializer
from instances.models import Instance
@ -164,7 +164,7 @@ class CreateInstanceViewTests(TestCase):
conn.get_firmwares.assert_called_once_with("x86_64", "q35")
class NicMacsTestCase(TestCase):
class NicMacsTestCase(SimpleTestCase):
def test_macs_follow_the_networks(self):
self.assertEqual(nic_macs("52:54:00:00:00:01", "a,b"), ["52:54:00:00:00:01"])
self.assertEqual(nic_macs("", "a,b"), [])