Commit 1297a106 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

Improve ids for item factory for tests

parent f8dbb4e9
from factory import fuzzy
from factory import DjangoModelFactory, lazy_attribute
import string
from factory import DjangoModelFactory, fuzzy
from faker import Factory
from metagenedb.apps.catalog import models
......@@ -14,7 +15,5 @@ class FunctionFactory(DjangoModelFactory):
model = models.Function
source = fuzzy.FuzzyChoice(SELECTED_SOURCE)
@lazy_attribute
def function_id(self):
return str(faker.pyint())
function_id = fuzzy.FuzzyText(prefix='function-', length=15,
chars=string.ascii_lowercase + ''.join(map(str, range(1, 10))))
from factory import DjangoModelFactory, lazy_attribute
import string
from factory import DjangoModelFactory, fuzzy
from faker import Factory
from metagenedb.apps.catalog import models
......@@ -12,10 +14,6 @@ class GeneFactory(DjangoModelFactory):
class Meta:
model = models.Gene
@lazy_attribute
def gene_id(self):
return str(faker.pyint())
@lazy_attribute
def length(self):
return str(faker.pyint())
gene_id = fuzzy.FuzzyText(prefix='gene-', length=15,
chars=string.ascii_lowercase + ''.join(map(str, range(1, 10))))
length = fuzzy.FuzzyInteger(200, 10000)
from factory import fuzzy
from factory import DjangoModelFactory, lazy_attribute
import string
from factory import DjangoModelFactory, fuzzy
from faker import Factory
from metagenedb.apps.catalog import models
......@@ -14,7 +15,5 @@ class TaxonomyFactory(DjangoModelFactory):
model = models.Taxonomy
rank = fuzzy.FuzzyChoice(SELECTED_RANK)
@lazy_attribute
def tax_id(self):
return str(faker.pyint())
tax_id = fuzzy.FuzzyText(prefix='tax-', length=15,
chars=string.ascii_lowercase + ''.join(map(str, range(1, 10))))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment