chore: enable creating reandom email field in model_kwarg_data fixture

ref: #839
This commit is contained in:
2025-06-19 21:22:55 +09:30
parent ae20451033
commit 874ce0c4f4

View File

@ -1,5 +1,4 @@
import datetime
import json
import pytest
from django.db import models
@ -14,8 +13,6 @@ def model_kwarg_data():
random_str = str(random_str).replace(
' ', '').replace(':', '').replace('+', '').replace('.', '').replace('-', '')
# data = {}
kwargs = {}
@ -51,6 +48,16 @@ def model_kwarg_data():
value = 'a' + random_str
if isinstance(getattr(model, field).field, models.IntegerField):
value = str(random_str)[( len(random_str) - 13 ):]
elif isinstance(getattr(model, field).field, models.EmailField):
value = str(random_str) + '@instance.tld'
kwargs.update({
field: value
})