Files
django-lasuite/tests/factories.py
Manuel Raynaud 1169eda8eb (malware_detection) limit simultaneous files analysis for jcop
For the JCOP backend we need to limit the number of simultaneous files
analysis. The number of simultaneous analysis must be configurable, by
default we limit it to 15.
To achieve this, we store in a table the pending analysis and a new
analysis is triggered at the end of a previous one.
2025-07-22 17:03:54 +02:00

29 lines
740 B
Python

"""Factories for creating test data."""
import factory.django
from django.contrib.auth import get_user_model
from lasuite.malware_detection.models import MalwareDetection
User = get_user_model()
class UserFactory(factory.django.DjangoModelFactory):
"""A factory to create random users for testing purposes."""
sub = factory.Sequence(lambda n: f"user{n!s}")
email = factory.Faker("email")
name = factory.Faker("name")
class Meta: # noqa: D106
model = User
class MalwareDetectionFactory(factory.django.DjangoModelFactory):
"""A factory to create random malware detections for testing purposes."""
path = factory.Faker("file_path")
class Meta: # noqa: D106
model = MalwareDetection