Beispiel #1
0
    def setUp(self):
        super(ReglaIncidenciaPorCalificacionTests, self).setUp()

        self.admin = self.crear_administrador()
        self.client.login(username=self.admin.username, password=PASSWORD)

        self.formulario = FormularioFactory()
        self.campo_formulario = FieldFormularioFactory(
            formulario=self.formulario)
        self.campana = CampanaFactory.create(type=Campana.TYPE_DIALER)
        self.nombre_opcion_1 = NombreCalificacionFactory.create()
        self.opcion_calificacion_1 = OpcionCalificacionFactory.create(
            campana=self.campana,
            nombre=self.nombre_opcion_1.nombre,
            tipo=OpcionCalificacion.GESTION,
            formulario=self.formulario)
        self.campana.opciones_calificacion.add(self.opcion_calificacion_1)
        self.nombre_opcion_2 = NombreCalificacionFactory.create()
        self.opcion_calificacion_2 = OpcionCalificacionFactory.create(
            campana=self.campana,
            nombre=self.nombre_opcion_2.nombre,
            tipo=OpcionCalificacion.NO_ACCION)
        self.campana.opciones_calificacion.add(self.opcion_calificacion_2)
        self.contacto = ContactoFactory.create()
        self.campana.bd_contacto.contactos.add(self.contacto)

        self.campana_extra = CampanaFactory.create(type=Campana.TYPE_DIALER)
        self.nombre_opcion_extra = NombreCalificacionFactory.create()
        self.opcion_calificacion_extra = OpcionCalificacionFactory.create(
            campana=self.campana_extra,
            nombre=self.nombre_opcion_extra.nombre,
            tipo=OpcionCalificacion.NO_ACCION)
        self.campana_extra.opciones_calificacion.add(
            self.opcion_calificacion_extra)
Beispiel #2
0
 def test_no_se_permite_eliminar_sitio_externo_asociado_campana(self):
     url = reverse('sitio_externo_delete', args=[self.sitio_externo.pk])
     self.client.login(username=self.admin.username, password=self.PWD)
     CampanaFactory.create(sitio_externo=self.sitio_externo, tipo_interaccion=2)
     n_sitio_externo = SitioExterno.objects.count()
     self.client.post(url, follow=True)
     self.assertEqual(SitioExterno.objects.count(), n_sitio_externo)
Beispiel #3
0
 def test_identificador_cliente_interaccion_externa_tipo1_envia_datos_correctos_creacion_astdb(
         self):
     campana_entrante_1 = CampanaFactory(type=Campana.TYPE_ENTRANTE)
     campana_entrante_2 = CampanaFactory(type=Campana.TYPE_ENTRANTE)
     ident_cliente = IdentificadorClienteFactory(
         tipo_interaccion=IdentificadorCliente.INTERACCION_EXTERNA_1)
     dest_entrante_1 = DestinoEntrante.crear_nodo_ruta_entrante(campana_entrante_1)
     dest_entrante_2 = DestinoEntrante.crear_nodo_ruta_entrante(campana_entrante_2)
     dest_entrante_ident_client = DestinoEntrante.crear_nodo_ruta_entrante(ident_cliente)
     OpcionDestino.crear_opcion_destino(
         dest_entrante_ident_client, dest_entrante_1, IdentificadorCliente.DESTINO_MATCH)
     OpcionDestino.crear_opcion_destino(
         dest_entrante_ident_client, dest_entrante_2, IdentificadorCliente.DESTINO_NO_MATCH)
     sync_ident_cliente = SincronizadorDeConfiguracionIdentificadorClienteAsterisk()
     gen_family = sync_ident_cliente._obtener_generador_family()
     dict_astdb = gen_family._create_dict(ident_cliente)
     self.assertEqual(dict_astdb['NAME'], ident_cliente.nombre)
     self.assertEqual(dict_astdb['TYPE'], ident_cliente.tipo_interaccion)
     self.assertEqual(dict_astdb['EXTERNALURL'], ident_cliente.url)
     audio_path = convert_audio_asterisk_path_astdb(ident_cliente.audio.audio_asterisk)
     self.assertEqual(dict_astdb['AUDIO'], audio_path)
     self.assertEqual(dict_astdb['LENGTH'], ident_cliente.longitud_id_esperado)
     self.assertEqual(dict_astdb['TIMEOUT'], ident_cliente.timeout)
     self.assertEqual(dict_astdb['RETRIES'], ident_cliente.intentos)
     self.assertEqual(dict_astdb['TRUEDST'], "{0},{1}".format(
         dest_entrante_1.tipo, dest_entrante_1.object_id))
     self.assertEqual(dict_astdb['FALSEDST'], "{0},{1}".format(
         dest_entrante_2.tipo, dest_entrante_2.object_id))
Beispiel #4
0
    def setUp(self):
        super(APITest, self).setUp()
        self.factory = RequestFactory()

        self.supervisor_admin = self.crear_supervisor_profile(
            rol=User.ADMINISTRADOR)
        self.supervisor = self.crear_supervisor_profile(rol=User.SUPERVISOR)
        self.agente_profile = self.crear_agente_profile()

        self.campana_activa = CampanaFactory.create(
            estado=Campana.ESTADO_ACTIVA)
        self.campana_activa_supervisor = CampanaFactory.create(
            estado=Campana.ESTADO_ACTIVA)
        self.campana_activa_supervisor.supervisors.add(self.supervisor.user)
        self.campana_finalizada = CampanaFactory(
            estado=Campana.ESTADO_FINALIZADA)
        self.queue = QueueFactory.create(campana=self.campana_activa)
        self.queue2 = QueueFactory.create(
            campana=self.campana_activa_supervisor)
        self.queue3 = QueueFactory.create(campana=self.campana_finalizada)
        QueueMemberFactory.create(member=self.agente_profile,
                                  queue_name=self.queue)
        self.sistema_externo = SistemaExternoFactory()
        self.opcion_calificacion = OpcionCalificacionFactory(
            campana=self.campana_activa)

        self.calificacion_cliente = CalificacionClienteFactory(
            opcion_calificacion=self.opcion_calificacion,
            agente=self.agente_profile)

        for user in User.objects.all():
            Token.objects.create(user=user)
    def setUp(self):
        self.supervisor = self.crear_supervisor_profile()

        self.client.login(username=self.supervisor.user.username,
                          password=PASSWORD)

        self.campana_preview = CampanaFactory(type=Campana.TYPE_PREVIEW,
                                              estado=Campana.ESTADO_ACTIVA,
                                              reported_by=self.supervisor.user)
        self.campana_preview.supervisors.add(self.supervisor.user)
        bd_contacto = self.campana_preview.bd_contacto

        self.campana_manual = CampanaFactory(type=Campana.TYPE_MANUAL,
                                             estado=Campana.ESTADO_ACTIVA,
                                             bd_contacto=bd_contacto)
        self.campana_manual.supervisors.add(self.supervisor.user)

        self.campana_preview_sin_permiso = CampanaFactory(
            type=Campana.TYPE_PREVIEW,
            estado=Campana.ESTADO_ACTIVA,
            bd_contacto=bd_contacto)

        self.post_data = {
            'telefono': '1234567',
            'nombre': 'NombreContacto',
            'apellido': 'ApellidoContacto',
            'dni': '20.202.020',
        }
Beispiel #6
0
    def setUp(self):
        super(AuditoriasCalificacionesTests, self).setUp()

        self.campana1 = CampanaFactory(estado=Campana.ESTADO_ACTIVA)
        self.campana2 = CampanaFactory(estado=Campana.ESTADO_ACTIVA)
        self.campana3 = CampanaFactory(estado=Campana.ESTADO_ACTIVA)

        self.supervisor1 = self.crear_supervisor_profile(rol=User.GERENTE)
        self.supervisor2 = self.crear_supervisor_profile(rol=User.GERENTE)
        self.supervisor3 = self.crear_supervisor_profile(rol=User.SUPERVISOR)
        self.supervisor4 = self.crear_supervisor_profile(rol=User.REFERENTE)

        # calificaciones y auditorias de gestion para campana1
        opcion_calificacion11 = OpcionCalificacionFactory(
            campana=self.campana1, tipo=OpcionCalificacion.GESTION)
        self.calificacion11 = CalificacionClienteFactory(
            opcion_calificacion=opcion_calificacion11)

        # calificacion de gestion para campana2
        opcion_calificacion21_gestion = OpcionCalificacionFactory(
            campana=self.campana2, tipo=OpcionCalificacion.GESTION)
        opcion_calificacion21_no_accion = OpcionCalificacionFactory(
            campana=self.campana2, tipo=OpcionCalificacion.NO_ACCION)
        self.calificacion21 = CalificacionClienteFactory(
            opcion_calificacion=opcion_calificacion21_no_accion)
        self.calificacion22 = CalificacionClienteFactory(
            opcion_calificacion=opcion_calificacion21_gestion)
        self.calificacion23 = CalificacionClienteFactory(
            opcion_calificacion=opcion_calificacion21_gestion)
        self.calificacion24 = CalificacionClienteFactory(
            opcion_calificacion=opcion_calificacion21_gestion)
        self.calificacion25 = CalificacionClienteFactory(
            opcion_calificacion=opcion_calificacion21_gestion)
        self.queue_campana_2 = QueueFactory(campana=self.campana2)
        QueueMemberFactory(member=self.calificacion25.agente,
                           queue_name=self.queue_campana_2)

        self.auditoria_aprobada = AuditoriaCalificacionFactory(
            calificacion=self.calificacion23,
            resultado=AuditoriaCalificacion.APROBADA)
        self.auditoria_rechazada = AuditoriaCalificacionFactory(
            calificacion=self.calificacion24,
            resultado=AuditoriaCalificacion.RECHAZADA)
        self.auditoria_rechazada = AuditoriaCalificacionFactory(
            calificacion=self.calificacion25,
            resultado=AuditoriaCalificacion.OBSERVADA)

        self.campana2.supervisors.add(self.supervisor2.user)
        self.campana3.supervisors.add(self.supervisor2.user)

        # calificacion de gestion para campana2
        opcion_calificacion31_gestion = OpcionCalificacionFactory(
            campana=self.campana3, tipo=OpcionCalificacion.GESTION)
        self.calificacion31 = CalificacionClienteFactory(
            opcion_calificacion=opcion_calificacion31_gestion)

        self.client.login(username=self.supervisor2.user,
                          password=self.DEFAULT_PASSWORD)
Beispiel #7
0
    def setUp(self):
        self.supervisor1 = self.crear_supervisor_profile(rol=User.SUPERVISOR)
        self.supervisor2 = self.crear_supervisor_profile(rol=User.SUPERVISOR)

        self.agente1 = self.crear_agente_profile()
        self.agente2 = self.crear_agente_profile()

        self.campana1 = CampanaFactory(estado=Campana.ESTADO_ACTIVA)
        self.queue_campana_1 = QueueFactory(campana=self.campana1)
        QueueMemberFactory(member=self.agente1,
                           queue_name=self.queue_campana_1)
        self.campana1.supervisors.add(self.supervisor1.user)

        self.campana2 = CampanaFactory(estado=Campana.ESTADO_ACTIVA)
        self.queue_campana_2 = QueueFactory(campana=self.campana2)
        QueueMemberFactory(member=self.agente2,
                           queue_name=self.queue_campana_2)
        self.campana2.supervisors.add(self.supervisor2.user)

        self.contacto = ContactoFactory(id_externo='id_ext')
        self.campana3 = CampanaFactory(estado=Campana.ESTADO_ACTIVA)
        self.campana3.bd_contacto.genera_contactos([self.contacto])
        self.campana3.supervisors.add(self.supervisor1.user)

        self.opcion_calificacion = OpcionCalificacionFactory(
            campana=self.campana1, tipo=OpcionCalificacion.GESTION)
        self.calificacion = CalificacionClienteFactory(
            opcion_calificacion=self.opcion_calificacion)
        update_change_reason(self.calificacion, 'calificacion')
        self.grabacion1 = GrabacionFactory.create(
            duracion=1,
            agente=self.agente1,
            callid=self.calificacion.callid,
            campana=self.campana1,
            id_cliente='-1')
        self.grabacion2 = GrabacionFactory(duracion=1,
                                           agente=self.agente1,
                                           campana=self.campana1)
        self.grabacion3 = GrabacionFactory(duracion=1,
                                           agente=self.agente1,
                                           campana=self.campana1)
        self.marca_campana1 = GrabacionMarcaFactory(
            callid=self.grabacion1.callid)
        self.marca_campana2 = GrabacionMarcaFactory(
            callid=self.grabacion2.callid)

        self.grabacion2_1 = GrabacionFactory.create(duracion=1,
                                                    agente=self.agente2,
                                                    campana=self.campana2)
        self.marca_campana2_1 = GrabacionMarcaFactory(
            callid=self.grabacion2_1.callid)

        self.grabacion3_1 = GrabacionFactory.create(
            tel_cliente=self.contacto.telefono,
            agente=self.agente2,
            campana=self.campana3)
Beispiel #8
0
    def setUp(self):
        super(GeneradorDeLlamadaLogsTests, self).setUp()
        self.manual = CampanaFactory.create(type=Campana.TYPE_MANUAL)
        self.usr_agente1 = UserFactory.create(username='******',
                                              is_agente=True)
        self.agente1 = AgenteProfileFactory.create(user=self.usr_agente1)

        self.dialer = CampanaFactory.create(type=Campana.TYPE_DIALER)
        self.contacto_d = ContactoFactory(bd_contacto=self.dialer.bd_contacto)

        self.entrante = CampanaFactory.create(type=Campana.TYPE_ENTRANTE)

        self.preview = CampanaFactory.create(type=Campana.TYPE_PREVIEW)
        self.contacto_p = ContactoFactory(bd_contacto=self.preview.bd_contacto)
Beispiel #9
0
    def setUp(self):
        super(ReporteDeLLamadasEntrantesDeSupervisionTest, self).setUp()
        self.generador = GeneradorDeLlamadaLogs()

        self.agente1 = self.crear_agente_profile()
        self.agente2 = self.crear_agente_profile()

        self.entrante1 = CampanaFactory.create(type=Campana.TYPE_ENTRANTE, nombre='camp-entrante-1',
                                               estado=Campana.ESTADO_ACTIVA)
        self.opcion_calificacion = OpcionCalificacionFactory(campana=self.entrante1,
                                                             tipo=OpcionCalificacion.GESTION)
        # Campaña que no debe estar en los reportes por no ser del supervisor
        self.entrante2 = CampanaFactory.create(type=Campana.TYPE_ENTRANTE, nombre='camp-entrante-2',
                                               estado=Campana.ESTADO_ACTIVA)
        self.queue = QueueFactory.create(campana=self.entrante1)
Beispiel #10
0
 def setUp(self, *args, **kwargs):
     self.agente = self.crear_agente_profile()
     self.sitio_externo = SitioExternoFactory()
     self.campana = CampanaFactory(sitio_externo=self.sitio_externo,
                                   tipo_interaccion=2)
     self.contacto = ContactoFactory()
     self.call_data = {
         'call_id': '1234',
         'agent_id': str(self.agente.id),
         'telefono': '351351351',
         'id_contacto': str(self.contacto.id),
         'rec_filename': 'rec_filename',
         'call_wait_duration': '44',
     }
     super(TestsSitioExterno, self).setUp(*args, **kwargs)
Beispiel #11
0
 def test_datos_reporte_grafico_llamadas_entrantes_promedio_tiempo_abandono(
         self):
     campana_entrante = CampanaFactory(type=Campana.TYPE_ENTRANTE,
                                       estado=Campana.ESTADO_ACTIVA)
     hoy = fecha_hora_local(timezone.now())
     self.generador_log_llamadas.generar_log(campana_entrante,
                                             False,
                                             'ABANDON',
                                             self.telefono1,
                                             agente=self.agente_profile,
                                             time=hoy,
                                             bridge_wait_time=4)
     LlamadaLogFactory(tipo_campana=Campana.TYPE_ENTRANTE,
                       tipo_llamada=LlamadaLog.LLAMADA_ENTRANTE,
                       campana_id=campana_entrante.pk,
                       event='ABANDONWEL',
                       bridge_wait_time=5,
                       time=hoy)
     hoy_ahora = fecha_hora_local(timezone.now())
     fecha_desde = datetime_hora_minima_dia_utc(hoy_ahora)
     fecha_hasta = datetime_hora_maxima_dia_utc(hoy_ahora)
     estadisticas_service = EstadisticasService(campana_entrante,
                                                fecha_desde, fecha_hasta)
     estadisticas_service.calcular_estadisticas_totales()
     self.assertEqual(
         estadisticas_service.reporte_totales_llamadas.
         tiempo_promedio_abandono, 4.5)
Beispiel #12
0
 def test_datos_reporte_grafico_llamadas_entrantes_promedio_tiempo_espera(
         self):
     campana_entrante = CampanaFactory(type=Campana.TYPE_ENTRANTE,
                                       estado=Campana.ESTADO_ACTIVA)
     hoy = fecha_hora_local(timezone.now())
     self.generador_log_llamadas.generar_log(campana_entrante,
                                             False,
                                             'COMPLETEAGENT',
                                             self.telefono1,
                                             agente=self.agente_profile,
                                             time=hoy,
                                             bridge_wait_time=4,
                                             callid=1)
     self.generador_log_llamadas.generar_log(campana_entrante,
                                             False,
                                             'COMPLETEOUTNUM',
                                             self.telefono2,
                                             agente=self.agente_profile,
                                             time=hoy,
                                             bridge_wait_time=2,
                                             callid=2)
     hoy_ahora = fecha_hora_local(timezone.now())
     fecha_desde = datetime_hora_minima_dia_utc(hoy_ahora)
     fecha_hasta = datetime_hora_maxima_dia_utc(hoy_ahora)
     estadisticas_service = EstadisticasService(campana_entrante,
                                                fecha_desde, fecha_hasta)
     estadisticas_service.calcular_estadisticas_totales()
     self.assertEqual(
         estadisticas_service.reporte_totales_llamadas.
         tiempo_promedio_espera, 3)
Beispiel #13
0
 def test_datos_reporte_grafico_llamadas_entrantes_realizadas_muestran_solo_dia_actual(
         self):
     campana_entrante = CampanaFactory(type=Campana.TYPE_ENTRANTE,
                                       estado=Campana.ESTADO_ACTIVA)
     hoy = fecha_hora_local(timezone.now())
     ayer = hoy - timedelta(days=1)
     self.generador_log_llamadas.generar_log(campana_entrante,
                                             True,
                                             'COMPLETEAGENT',
                                             self.telefono1,
                                             agente=self.agente_profile,
                                             time=ayer)
     self.generador_log_llamadas.generar_log(campana_entrante,
                                             True,
                                             'COMPLETEOUTNUM',
                                             self.telefono2,
                                             agente=self.agente_profile,
                                             time=hoy)
     hoy_ahora = fecha_hora_local(timezone.now())
     fecha_desde = datetime_hora_minima_dia_utc(hoy_ahora)
     fecha_hasta = datetime_hora_maxima_dia_utc(hoy_ahora)
     estadisticas_service = EstadisticasService(campana_entrante,
                                                fecha_desde, fecha_hasta)
     estadisticas_service.calcular_estadisticas_totales()
     self.assertEqual(
         estadisticas_service.reporte_totales_llamadas.llamadas_realizadas,
         1)
Beispiel #14
0
    def setUp(self):
        super(CalificacionTests, self).setUp()

        self.agente_profile = self.crear_agente_profile()
        self.usuario_agente = self.agente_profile.user

        self.campana = CampanaFactory.create()
        self.nombre_opcion_gestion = NombreCalificacionFactory.create()
        self.nombre_calificacion_agenda = NombreCalificacion.objects.get(
            nombre=settings.CALIFICACION_REAGENDA)
        self.formulario = FormularioFactory()
        self.campo_formulario = FieldFormularioFactory(formulario=self.formulario)
        self.opcion_calificacion_gestion = OpcionCalificacionFactory.create(
            campana=self.campana, nombre=self.nombre_opcion_gestion.nombre,
            tipo=OpcionCalificacion.GESTION, formulario=self.formulario)
        self.opcion_calificacion_agenda = OpcionCalificacionFactory.create(
            campana=self.campana, nombre=self.nombre_calificacion_agenda.nombre,
            tipo=OpcionCalificacion.AGENDA)
        self.opcion_calificacion_camp_manual = OpcionCalificacionFactory.create(
            campana=self.campana, nombre=self.nombre_opcion_gestion.nombre)
        self.opcion_calificacion_no_accion = OpcionCalificacionFactory.create(
            campana=self.campana, tipo=OpcionCalificacion.NO_ACCION)

        self.contacto = ContactoFactory.create()
        self.campana.bd_contacto.contactos.add(self.contacto)

        self.queue = QueueFactory.create(campana=self.campana)

        self.calificacion_cliente = CalificacionClienteFactory(
            opcion_calificacion=self.opcion_calificacion_camp_manual, agente=self.agente_profile,
            contacto=self.contacto)

        QueueMemberFactory.create(member=self.agente_profile, queue_name=self.queue)

        self.client.login(username=self.usuario_agente.username, password=PASSWORD)
Beispiel #15
0
    def setUp(self):
        self.usuario_admin_supervisor = UserFactory(is_staff=True,
                                                    is_supervisor=True)
        self.usuario_admin_supervisor.set_password(self.PWD)
        self.usuario_admin_supervisor.save()

        self.user_agente = self.crear_user_agente()
        self.campana = CampanaFactory()
        self.agente_profile = self.crear_agente_profile(self.user_agente)
        self.opcion_calificacion = OpcionCalificacionFactory(
            campana=self.campana, tipo=OpcionCalificacion.GESTION)
        self.calificacion = CalificacionClienteFactory(
            opcion_calificacion=self.opcion_calificacion)
        self.grabacion1 = GrabacionFactory.create(
            duracion=0,
            agente=self.agente_profile,
            callid=self.calificacion.callid,
            campana=self.campana)
        self.grabacion2 = GrabacionFactory(duracion=0,
                                           agente=self.agente_profile,
                                           campana=self.campana)
        self.grabacion3 = GrabacionFactory(duracion=0,
                                           agente=self.agente_profile,
                                           campana=self.campana)
        self.marca_campana1 = GrabacionMarcaFactory(
            callid=self.grabacion1.callid)
        self.marca_campana2 = GrabacionMarcaFactory(
            callid=self.grabacion2.callid)

        self.client.login(username=self.usuario_admin_supervisor.username,
                          password=self.PWD)
    def test_creacion_usuario_preview_por_supervisor_crea_agente_en_contacto(
            self):
        usr_supervisor = self.campana.reported_by
        campana = CampanaFactory(type=Campana.TYPE_PREVIEW,
                                 estado=Campana.ESTADO_ACTIVA,
                                 bd_contacto=self.campana.bd_contacto,
                                 reported_by=usr_supervisor)
        campana.supervisors.add(usr_supervisor)
        QueueFactory(campana=campana)
        QueueMemberFactory.create(member=self.agente,
                                  queue_name=campana.queue_campana)
        self.client.logout()
        self.client.login(username=usr_supervisor.username, password=self.PWD)

        post_data = self.post_data_contacto
        post_data['idCampaign'] = str(campana.id)
        response = self.client.post(self.URL,
                                    json.dumps(post_data),
                                    format='json',
                                    content_type='application/json')

        self.assertEqual(response.status_code, 200)
        agente_en_contacto = AgenteEnContacto.objects.filter(
            campana_id=campana.id,
            contacto_id=response.json()['id'],
            agente_id=-1,
            es_originario=True)
        self.assertEqual(agente_en_contacto.count(), 1)
 def test_datos_reporte_grafico_detalle_llamadas_dialer_coinciden_estadisticas_sistema(
         self, obtener_dato_campana_run):
     obtener_dato_campana_run.return_value = {'n_est_remaining_calls': 0}
     campana_dialer = CampanaFactory(type=Campana.TYPE_DIALER, estado=Campana.ESTADO_ACTIVA)
     self.generador_log_llamadas.generar_log(
         campana_dialer, False, 'COMPLETEAGENT', self.telefono1, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_dialer, False, 'COMPLETEOUTNUM', self.telefono2, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_dialer, False, 'ABANDON', self.telefono3, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_dialer, False, 'EXITWITHTIMEOUT', self.telefono4, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_dialer, False, 'CANCEL', self.telefono4, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_dialer, True, 'COMPLETEAGENT', self.telefono1, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_dialer, True, 'COMPLETEOUTNUM', self.telefono2, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_dialer, True, 'NOANSWER', self.telefono2, agente=self.agente_profile)
     hoy_ahora = fecha_hora_local(timezone.now())
     fecha_desde = datetime_hora_minima_dia_utc(hoy_ahora)
     fecha_hasta = datetime_hora_maxima_dia_utc(hoy_ahora)
     estadisticas_service = EstadisticasService(campana_dialer, fecha_desde, fecha_hasta)
     estadisticas_service.calcular_estadisticas_totales()
     reporte = estadisticas_service.reporte_detalle_llamadas.reporte
     self.assertEqual(reporte['Discadas'], 5)
     self.assertEqual(reporte['Conectadas al agente'], 2)
     self.assertEqual(reporte['Atendidas'], 4)
     self.assertEqual(reporte['Perdidas'], 2)
     self.assertEqual(reporte['Manuales'], 3)
     self.assertEqual(reporte['Manuales atendidas'], 2)
     self.assertEqual(reporte['Manuales no atendidas'], 1)
    def _crear_campana_entrante(self):
        # crear campaña entrante
        campana = CampanaFactory(nombre='test_entrante_campaign',
                                 bd_contacto=self.bd_contacto,
                                 type=Campana.TYPE_ENTRANTE,
                                 reported_by=self.admin,
                                 estado=Campana.ESTADO_ACTIVA)
        # crear Queue para la campaña
        Queue.objects.create(campana=campana,
                             name=campana.nombre,
                             maxlen=5,
                             timeout=3,
                             retry=3,
                             wrapuptime=5,
                             servicelevel=30,
                             strategy='ringall',
                             eventmemberstatus=True,
                             eventwhencalled=True,
                             ringinuse=True,
                             setinterfacevar=True,
                             weight=0,
                             wait=120)

        self._crear_opciones_calificacion(campana)

        return campana
Beispiel #19
0
 def test_datos_reporte_grafico_detalle_llamadas_manuales_coinciden_estadisticas_sistema(
         self):
     campana_manual = CampanaFactory(type=Campana.TYPE_MANUAL,
                                     estado=Campana.ESTADO_ACTIVA)
     self.generador_log_llamadas.generar_log(campana_manual,
                                             True,
                                             'COMPLETEAGENT',
                                             self.telefono1,
                                             agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(campana_manual,
                                             True,
                                             'COMPLETEOUTNUM',
                                             self.telefono2,
                                             agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(campana_manual,
                                             True,
                                             'FAIL',
                                             self.telefono3,
                                             agente=self.agente_profile)
     hoy_ahora = fecha_hora_local(timezone.now())
     fecha_desde = datetime_hora_minima_dia_utc(hoy_ahora)
     fecha_hasta = datetime_hora_maxima_dia_utc(hoy_ahora)
     estadisticas_service = EstadisticasService(campana_manual, fecha_desde,
                                                fecha_hasta)
     estadisticas_service.calcular_estadisticas_totales()
     reporte = estadisticas_service.reporte_detalle_llamadas.reporte
     self.assertEqual(reporte['Discadas'], 3)
     self.assertEqual(reporte['Discadas atendidas'], 2)
     self.assertEqual(reporte['Discadas no atendidas'], 1)
 def test_datos_reporte_grafico_total_llamadas_entrantes_coinciden_estadisticas_sistema(self):
     campana_entrante = CampanaFactory(type=Campana.TYPE_ENTRANTE, estado=Campana.ESTADO_ACTIVA)
     self.generador_log_llamadas.generar_log(
         campana_entrante, False, 'COMPLETEAGENT', self.telefono1, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_entrante, False, 'COMPLETEOUTNUM', self.telefono2, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_entrante, False, 'EXITWITHTIMEOUT', self.telefono3, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_entrante, False, 'ABANDON', self.telefono4, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_entrante, True, 'COMPLETEAGENT', self.telefono1, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_entrante, True, 'COMPLETEOUTNUM', self.telefono2, agente=self.agente_profile)
     hoy_ahora = fecha_hora_local(timezone.now())
     fecha_desde = datetime_hora_minima_dia_utc(hoy_ahora)
     fecha_hasta = datetime_hora_maxima_dia_utc(hoy_ahora)
     estadisticas_service = EstadisticasService(campana_entrante, fecha_desde, fecha_hasta)
     estadisticas_service.calcular_estadisticas_totales()
     reporte = estadisticas_service.reporte_detalle_llamadas.reporte
     self.assertEqual(reporte['Recibidas'], 4)
     self.assertEqual(reporte['Atendidas'], 2)
     self.assertEqual(reporte['Expiradas'], 1)
     self.assertEqual(reporte['Abandonadas'], 1)
     self.assertEqual(reporte['Manuales'], 2)
     self.assertEqual(reporte['Manuales atendidas'], 2)
     self.assertEqual(reporte['Manuales no atendidas'], 0)
 def test_datos_reporte_grafico_detalle_llamadas_dialer_coinciden_estadisticas_sistema(self):
     campana_dialer = CampanaFactory(type=Campana.TYPE_DIALER, estado=Campana.ESTADO_ACTIVA)
     self.generador_log_llamadas.generar_log(
         campana_dialer, False, 'COMPLETEAGENT', self.telefono1, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_dialer, False, 'COMPLETEOUTNUM', self.telefono2, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_dialer, False, 'ABANDON', self.telefono3, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_dialer, False, 'EXITWITHTIMEOUT', self.telefono4, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_dialer, False, 'CANCEL', self.telefono4, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_dialer, True, 'COMPLETEAGENT', self.telefono1, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_dialer, True, 'COMPLETEOUTNUM', self.telefono2, agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(
         campana_dialer, True, 'NOANSWER', self.telefono2, agente=self.agente_profile)
     estadisticas_service = EstadisticasService()
     hoy = fecha_local(timezone.now())
     reporte = estadisticas_service.calcular_cantidad_llamadas(campana_dialer, hoy, hoy)
     self.assertEqual(reporte['Discadas'], 5)
     self.assertEqual(reporte['Conectadas al agente'], 2)
     self.assertEqual(reporte['Atendidas'], 4)
     self.assertEqual(reporte['Perdidas'], 2)
     self.assertEqual(reporte['Manuales'], 3)
     self.assertEqual(reporte['Manuales atendidas'], 2)
     self.assertEqual(reporte['Manuales no atendidas'], 1)
    def setUp(self):
        super(AuditoriaDeGestionTests, self).setUp()

        self.supervisor = self.crear_supervisor_profile()
        self.client.login(username=self.supervisor.user.username,
                          password=PASSWORD)

        self.campana = CampanaFactory.create(estado=Campana.ESTADO_ACTIVA)
        self.campana.supervisors.add(self.supervisor.user)

        self.opcion_calificacion_gestion = OpcionCalificacionFactory.create(
            campana=self.campana, tipo=OpcionCalificacion.GESTION)
        self.opcion_calificacion_no_gestion = OpcionCalificacionFactory.create(
            campana=self.campana, tipo=OpcionCalificacion.NO_ACCION)

        self.contacto_gestion = ContactoFactory.create()
        self.campana.bd_contacto.contactos.add(self.contacto_gestion)
        self.contacto_no_gestion = ContactoFactory.create()
        self.campana.bd_contacto.contactos.add(self.contacto_no_gestion)

        self.agente = self.crear_agente_profile()
        self.calificacion_gestion = CalificacionClienteFactory(
            opcion_calificacion=self.opcion_calificacion_gestion,
            agente=self.agente,
            contacto=self.contacto_gestion)
        self.calificacion_no_gestion = CalificacionClienteFactory(
            opcion_calificacion=self.opcion_calificacion_no_gestion,
            agente=self.agente,
            contacto=self.contacto_no_gestion)
Beispiel #23
0
 def _agregar_campana_y_contacto(self, agente_profile, tipo_campana):
     campana = CampanaFactory.create(type=tipo_campana,
                                     tiempo_desconexion=3,
                                     estado=Campana.ESTADO_ACTIVA)
     self._hacer_miembro(agente_profile, campana)
     contacto = ContactoFactory.create(bd_contacto=campana.bd_contacto)
     return campana, contacto
 def test_datos_reporte_grafico_detalle_llamadas_manuales_coinciden_estadisticas_sistema(
         self):
     campana_manual = CampanaFactory(type=Campana.TYPE_MANUAL,
                                     estado=Campana.ESTADO_ACTIVA)
     self.generador_log_llamadas.generar_log(campana_manual,
                                             True,
                                             'COMPLETEAGENT',
                                             self.telefono1,
                                             agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(campana_manual,
                                             True,
                                             'COMPLETEOUTNUM',
                                             self.telefono2,
                                             agente=self.agente_profile)
     self.generador_log_llamadas.generar_log(campana_manual,
                                             True,
                                             'FAIL',
                                             self.telefono3,
                                             agente=self.agente_profile)
     estadisticas_service = EstadisticasService()
     hoy = fecha_local(timezone.now())
     reporte = estadisticas_service.calcular_cantidad_llamadas(
         campana_manual, hoy, hoy)
     self.assertEqual(reporte['Discadas'], 3)
     self.assertEqual(reporte['Discadas atendidas'], 2)
     self.assertEqual(reporte['Discadas no atendidas'], 1)
Beispiel #25
0
    def _crear_campana_manual(self):
        # crear campaña manual
        campana = CampanaFactory(nombre='test_manual_campaign',
                                 bd_contacto=self.bd_contacto,
                                 type=Campana.TYPE_MANUAL,
                                 reported_by=self.admin,
                                 estado=Campana.ESTADO_ACTIVA)
        # crear Queue para la campaña
        Queue.objects.create(
            campana=campana,
            name=campana.nombre,
            maxlen=5,
            wrapuptime=5,
            servicelevel=30,
            strategy='rrmemory',
            eventmemberstatus=True,
            eventwhencalled=True,
            ringinuse=True,
            setinterfacevar=True,
            weight=0,
            wait=120,
            auto_grabacion=True,
        )

        self._crear_opciones_calificacion(campana)

        return campana
 def test_datos_reporte_grafico_llamadas_entrantes_promedio_tiempo_espera(
         self):
     campana_entrante = CampanaFactory(type=Campana.TYPE_ENTRANTE,
                                       estado=Campana.ESTADO_ACTIVA)
     hoy = fecha_hora_local(timezone.now())
     self.generador_log_llamadas.generar_log(campana_entrante,
                                             False,
                                             'COMPLETEAGENT',
                                             self.telefono1,
                                             agente=self.agente_profile,
                                             time=hoy,
                                             bridge_wait_time=4,
                                             callid=1)
     self.generador_log_llamadas.generar_log(campana_entrante,
                                             False,
                                             'COMPLETEOUTNUM',
                                             self.telefono2,
                                             agente=self.agente_profile,
                                             time=hoy,
                                             bridge_wait_time=2,
                                             callid=2)
     estadisticas_service = EstadisticasService()
     _, _, _, tiempo_promedio_espera, _ = estadisticas_service.obtener_total_llamadas(
         campana_entrante)
     self.assertEqual(tiempo_promedio_espera, 3)
    def setUp(self):
        self.usuario_admin_supervisor = UserFactory(is_staff=True, is_supervisor=True)
        self.usuario_admin_supervisor.set_password(self.PWD)
        self.usuario_admin_supervisor.save()
        self.agente_profile = AgenteProfileFactory.create(user=self.usuario_admin_supervisor)

        self.nombre_calificacion = NombreCalificacionFactory.create(nombre=self.CALIFICACION_NOMBRE)
        self.nombre_calificacion_gestion = NombreCalificacionFactory.create(nombre=self.GESTION)

        self.campana_activa = CampanaFactory.create(
            estado=Campana.ESTADO_ACTIVA, type=Campana.TYPE_PREVIEW)

        self.contacto_calificado_gestion = ContactoFactory(
            bd_contacto=self.campana_activa.bd_contacto)
        self.contacto_calificado_no_accion = ContactoFactory(
            bd_contacto=self.campana_activa.bd_contacto)
        self.contacto_no_atendido = ContactoFactory(bd_contacto=self.campana_activa.bd_contacto)
        self.contacto_no_calificado = ContactoFactory(bd_contacto=self.campana_activa.bd_contacto)

        self.opcion_calificacion_gestion = OpcionCalificacionFactory.create(
            campana=self.campana_activa, nombre=self.nombre_calificacion_gestion.nombre,
            tipo=OpcionCalificacion.GESTION)
        self.opcion_calificacion_noaccion = OpcionCalificacionFactory.create(
            campana=self.campana_activa, nombre=self.nombre_calificacion.nombre,
            tipo=OpcionCalificacion.NO_ACCION)

        self.telefono1 = self.contacto_calificado_gestion.telefono
        self.telefono2 = self.contacto_calificado_no_accion.telefono
        self.telefono3 = self.contacto_no_atendido.telefono
        self.telefono4 = self.contacto_no_calificado.telefono

        self.generador_log_llamadas = GeneradorDeLlamadaLogs()
        self.generador_log_llamadas.generar_log(
            self.campana_activa, False, 'COMPLETEAGENT', self.telefono1, agente=self.agente_profile,
            contacto=self.contacto_calificado_gestion, duracion_llamada=self.DURACION_LLAMADA,
            callid=1)
        self.generador_log_llamadas.generar_log(
            self.campana_activa, False, 'COMPLETEAGENT', self.telefono2, agente=self.agente_profile,
            contacto=self.contacto_calificado_no_accion, duracion_llamada=self.DURACION_LLAMADA,
            callid=2)
        self.generador_log_llamadas.generar_log(
            self.campana_activa, True, 'NOANSWER', self.telefono3, agente=self.agente_profile,
            contacto=self.contacto_no_atendido, callid=3)
        self.generador_log_llamadas.generar_log(
            self.campana_activa, True, 'COMPLETEOUTNUM', self.telefono4, agente=self.agente_profile,
            contacto=self.contacto_no_calificado, duracion_llamada=0, callid=4)
        callid_gestion = LlamadaLog.objects.get(
            contacto_id=self.contacto_calificado_gestion.pk, event='COMPLETEAGENT').callid
        callid_no_accion = LlamadaLog.objects.get(
            contacto_id=self.contacto_calificado_no_accion.pk, event='COMPLETEAGENT').callid
        self.calif_gestion = CalificacionClienteFactory.create(
            opcion_calificacion=self.opcion_calificacion_gestion, agente=self.agente_profile,
            contacto=self.contacto_calificado_gestion, callid=callid_gestion)
        self.calif_no_accion = CalificacionClienteFactory.create(
            opcion_calificacion=self.opcion_calificacion_noaccion, agente=self.agente_profile,
            contacto=self.contacto_calificado_no_accion, callid=callid_no_accion)
        CalificacionCliente.history.all().update(history_change_reason='calificacion')

        self.client.login(username=self.usuario_admin_supervisor.username, password=self.PWD)
Beispiel #28
0
    def setUp(self, *args, **kwargs):
        super(TestsRutasEntrantes, self).setUp(*args, **kwargs)

        self.admin = self.crear_administrador()
        self.admin.set_password(self.PWD)

        # Creo un Supervisor Normal
        self.usr_sup = self.crear_user_supervisor()
        self.crear_supervisor_profile(self.usr_sup)

        # Creo un Supervisor Customer
        self.usr_customer = self.crear_user_supervisor()
        self.crear_supervisor_profile(self.usr_customer, is_customer=True)

        self.campana_entrante = CampanaFactory(type=Campana.TYPE_ENTRANTE)
        self.destino_campana_entrante = DestinoEntrante.crear_nodo_ruta_entrante(
            self.campana_entrante)

        self.ivr = IVRFactory()
        self.destino_ivr = DestinoEntrante.crear_nodo_ruta_entrante(self.ivr)

        self.opc_dest_ivr_time_out = OpcionDestinoFactory(
            valor=IVR.VALOR_TIME_OUT,
            destino_anterior=self.destino_ivr,
            destino_siguiente=self.destino_campana_entrante)
        self.opc_dest_ivr_invalid = OpcionDestinoFactory(
            valor=IVR.VALOR_DESTINO_INVALIDO,
            destino_anterior=self.destino_ivr,
            destino_siguiente=self.destino_ivr)
        self.opc_dest_ivr_camp_entrante_1 = OpcionDestinoFactory(
            valor='1',
            destino_anterior=self.destino_ivr,
            destino_siguiente=self.destino_campana_entrante)
        self.opc_dest_ivr_ivr_2 = OpcionDestinoFactory(
            valor='2',
            destino_anterior=self.destino_ivr,
            destino_siguiente=self.destino_ivr)

        self.validacion_tiempo = ValidacionTiempoFactory()
        self.grupo_horario = self.validacion_tiempo.grupo_horario

        self.validacion_fecha_hora = ValidacionFechaHoraFactory(
            grupo_horario=self.grupo_horario)
        self.destino_val_fecha_hora = DestinoEntrante.crear_nodo_ruta_entrante(
            self.validacion_fecha_hora)
        self.opc_dest_val_fecha_hora_true = OpcionDestinoFactory(
            valor=ValidacionFechaHora.DESTINO_MATCH,
            destino_anterior=self.destino_val_fecha_hora,
            destino_siguiente=self.destino_campana_entrante)
        self.opc_dest_val_fecha_hora_false = OpcionDestinoFactory(
            valor=ValidacionFechaHora.DESTINO_NO_MATCH,
            destino_anterior=self.destino_val_fecha_hora,
            destino_siguiente=self.destino_ivr)

        self.archivo_audio = ArchivoDeAudioFactory()

        self.ruta_entrante = RutaEntranteFactory(
            destino=self.destino_campana_entrante)
Beispiel #29
0
    def no_puede_calificar_si_no_esta_asignado(self):
        campana2 = CampanaFactory.create()
        contacto2 = ContactoFactory.create(bd_contacto=campana2.bd_contacto)

        url = reverse('calificacion_formulario_update_or_create',
                      kwargs={'pk_campana': campana2.pk,
                              'pk_contacto': contacto2.pk})
        response = self.client.get(url, follow=True)
        self.assertContains(response, _("No tiene permiso para calificar llamadas de esa campaña."))
Beispiel #30
0
    def setUp(self):
        super(APITest, self).setUp()
        self.factory = RequestFactory()

        self.supervisor_admin = self.crear_supervisor_profile(
            rol=User.ADMINISTRADOR)
        self.supervisor = self.crear_supervisor_profile(rol=User.SUPERVISOR)
        self.agente_profile = self.crear_agente_profile()

        self.campana_activa = CampanaFactory.create(
            estado=Campana.ESTADO_ACTIVA,
            type=Campana.TYPE_MANUAL,
            nombre='activa uno')
        self.campana_activa_2 = CampanaFactory.create(
            estado=Campana.ESTADO_ACTIVA,
            type=Campana.TYPE_PREVIEW,
            nombre='activa dos')
        self.campana_activa_supervisor = CampanaFactory.create(
            estado=Campana.ESTADO_ACTIVA,
            type=Campana.TYPE_ENTRANTE,
            nombre='activa supervisor uno')
        self.campana_activa_supervisor.supervisors.add(self.supervisor.user)
        self.campana_finalizada = CampanaFactory(
            estado=Campana.ESTADO_FINALIZADA)
        self.queue = QueueFactory.create(campana=self.campana_activa)
        self.queue1 = QueueFactory.create(campana=self.campana_activa_2)
        self.queue2 = QueueFactory.create(
            campana=self.campana_activa_supervisor)
        self.queue3 = QueueFactory.create(campana=self.campana_finalizada)
        QueueMemberFactory.create(member=self.agente_profile,
                                  queue_name=self.queue)
        self.sistema_externo = SistemaExternoFactory()
        self.opcion_calificacion = OpcionCalificacionFactory(
            campana=self.campana_activa)

        self.contacto = ContactoFactory(
            bd_contacto=self.campana_activa.bd_contacto)
        self.calificacion_cliente = CalificacionClienteFactory(
            opcion_calificacion=self.opcion_calificacion,
            agente=self.agente_profile,
            contacto=self.contacto)

        for user in User.objects.all():
            Token.objects.create(user=user)