class RespuestaFormularioGestionFactory(DjangoModelFactory): class Meta: model = RespuestaFormularioGestion calificacion = SubFactory(CalificacionClienteFactory) metadata = lazy_attribute(lambda a: '["{0}", "{1}", "{2}", "{3}", "{4}"]'.format( faker.name(), faker.name(), faker.random_number(7), faker.phone_number(), faker.phone_number()))
class ContactoFactory(DjangoModelFactory): class Meta: model = Contacto telefono = lazy_attribute(lambda a: str(faker.random_number(10))) id_externo = None datos = lazy_attribute(lambda a: '["{0}", "{1}", "{2}", "{3}", "{4}"]'.format( faker.name(), faker.name(), faker.random_number(7), faker.phone_number(), faker.phone_number())) bd_contacto = SubFactory(BaseDatosContactoFactory)
def init_collection_data(): person_collection = test_db['person'] persons = [] for num in range(1000000): if num > 0 and num % 10000 == 0: person_collection.insert_many(persons) persons.clear() print(person_collection.count_documents({})) persons.append({ 'name': faker.name(), 'address': faker.address(), 'phone': faker.phone_number(), 'postcode': faker.postcode(), 'age': str(faker.date_of_birth(minimum_age=18, maximum_age=30)), 'company': faker.company(), 'license_plate': faker.license_plate() }) if persons: person_collection.insert_many(persons)
class RutaEntranteFactory(DjangoModelFactory): class Meta: model = RutaEntrante nombre = Sequence(lambda n: "Ruta entrante {0}".format(n)) telefono = lazy_attribute(lambda a: faker.phone_number()) prefijo_caller_id = Sequence(lambda n: "Prefijo caller id {0}".format(n)) idioma = 1 destino = SubFactory(DestinoEntranteFactory)
class LlamadaLogFactory(DjangoModelFactory): class Meta: model = LlamadaLog time = lazy_attribute(lambda a: timezone.now()) callid = lazy_attribute(lambda a: faker.ean8()) campana_id = Sequence(lambda n: n) tipo_campana = lazy_attribute(lambda a: faker.random_int(1, 4)) agente_id = Sequence(lambda n: n) event = Sequence(lambda n: "evento_{0}".format(n)) numero_marcado = lazy_attribute(lambda a: faker.phone_number()) contacto_id = Sequence(lambda n: n) bridge_wait_time = lazy_attribute(lambda a: faker.random_number(3)) duracion_llamada = lazy_attribute(lambda a: faker.random_number(3)) archivo_grabacion = lazy_attribute(lambda a: faker.text(15))