chore: enable creating reandom email field in model_kwarg_data fixture
ref: #839
This commit is contained in:
13
app/tests/fixtures/model_kwarg_data.py
vendored
13
app/tests/fixtures/model_kwarg_data.py
vendored
@ -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
|
||||
})
|
||||
|
Reference in New Issue
Block a user