mirror of
https://github.com/suitenumerique/django-lasuite
synced 2026-04-26 01:25:28 +02:00
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.
29 lines
740 B
Python
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
|