fix factory uuid method
This commit is contained in:
parent
71241e7c63
commit
c018b745ff
|
@ -1,6 +1,6 @@
|
|||
import factory
|
||||
import random
|
||||
import time, datetime
|
||||
import time, datetime, uuid
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
@ -8,6 +8,10 @@ from pairent_app.models import Apartament, User
|
|||
|
||||
factory.Faker.override_default_locale('ru_RU');
|
||||
|
||||
class UUID(factory.declarations.BaseDeclaration):
|
||||
def evaluate(self, instance, step, extra):
|
||||
return str(uuid.uuid4()).upper();
|
||||
|
||||
class OpenID_Address(factory.declarations.BaseDeclaration):
|
||||
def evaluate(self, instance, step, extra):
|
||||
return ''.join(random.choices(list('abcdef12345678990'), k=6)) + "@vvsu.ru";
|
||||
|
@ -129,5 +133,5 @@ class UserFactory(factory.django.DjangoModelFactory):
|
|||
role = 's'
|
||||
|
||||
openid_addr = OpenID_Address();
|
||||
openid_id = factory.faker.Faker('uuid');
|
||||
openid_id = UUID();
|
||||
photo_provider = Random(0,0,0, ['VVSU', 'GRAVATAR']);
|
Loading…
Reference in New Issue