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