Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Feature incloure tests privats desde la branca al repositori UPC #174

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions filtres/nou.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def es_aplicable(self):

def obtenir_parametres_addicionals(self):
defaults = {"equipResolutor": settings.get("equip_resolutor_nous")}
if settings.get("valors_defecte") is None:
return defaults
for item in settings.get("valors_defecte"):
regex = re.compile(item['match'], re.IGNORECASE)
for header_name in item['order']:
Expand Down
6 changes: 3 additions & 3 deletions mailticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ class MailTicket:

def __init__(self, fitxer):
self.filtrar_attachments_per_nom \
= settings.get("filtrar_attachments_per_nom")
= settings.get("filtrar_attachments_per_nom") or []
self.filtrar_attachments_per_hash \
= settings.get("filtrar_attachments_per_hash")
self.mails_no_ticket = settings.get("mails_no_ticket")
= settings.get("filtrar_attachments_per_hash") or []
self.mails_no_ticket = settings.get("mails_no_ticket") or []

self.msg = email.message_from_file(fitxer)
# Farem lazy initialization d'aquestes 2 properties per si hi ha
Expand Down
39 changes: 39 additions & 0 deletions test/mails/attachment_signatura.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Subject: Mail amb attachment que es una signatura
To: mailtoticket@example.com
From: usuari.qualsevol@example.com
Date: Wed, 14 Jan 2015 09:41:15 +0100
MIME-Version: 1.0
Content-type: multipart/mixed;
Boundary="0__=4EBBF75EDFBC2A818f9e8a93df938690918c4EBBF75EDFBC2A81"
Content-Disposition: inline

--0__=4EBBF75EDFBC2A818f9e8a93df938690918c4EBBF75EDFBC2A81
Content-type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: quoted-printable




Prova

(Embedded
image moved
to file:
pic01487.jpg)

=

--0__=4EBBF75EDFBC2A818f9e8a93df938690918c4EBBF75EDFBC2A81
Content-type: image/jpeg;
name="pic01487.jpg"
Content-Disposition: attachment; filename="pic01487.jpg"
Content-transfer-encoding: base64

/9j/4AAQSkZJRgABAQEAYABgAAD/4QAWRXhpZgAASUkqAAgAAAAAAAAAAAD/2wBDAAEBAQEBAQEB
AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/
2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
AQEBAQEBAQEBAQH/wAARCAABAAEDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAr/xAAU
EAEAAAAAAAAAAAAAAAAAAAAA/8QAFAEBAAAAAAAAAAAAAAAAAAAAAP/EABQRAQAAAAAAAAAAAAAA
AAAAAAD/2gAMAwEAAhEDEQA/AL+AAf/Z

--0__=4EBBF75EDFBC2A818f9e8a93df938690918c4EBBF75EDFBC2A81--
20 changes: 20 additions & 0 deletions test/mails/mail-accents.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

I si ara responc aquí què passa!
I amb el charset utf8 i tot com toca

El jueves, 11 de diciembre de 2014 9:04:50, mailtoticket@example.com escribió:
> El tiquet *999999* amb prioritat *#CodiUrgencia:#Urgencia *sol·licitat per
> *#Solicitant* t'ha estat assignat.
>
> Assumpte: *mail amb accénts*
>
> Descripció:
> [Tiquet creat automaticament des de mail a Thu Dec 11 09:04:50 2014 ]
>
> I aquí també
>
> ç
>
>
642 changes: 642 additions & 0 deletions test/mails/mail-office.txt

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions test/mails/mail_enviat_usuari_concret.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
From: Usuari Concret <usuari.concret@example.com>
Subject: Mail enviat des d'un usuari concret
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Mail que s'envia des d'un usuari concret
8 changes: 8 additions & 0 deletions test/mails/mail_redirigit_usuari_concret.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Resent-From: Usuari Concret <usuari.concret@example.com>
Resent-To: mailtoticket@example.com
From: usuari.qualsevol@example.com
Subject: Mail reenviat des d'un usuari concret
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Mail que s'envia des d'un usuari qualsevol i redirigit per un usuari concret
154 changes: 154 additions & 0 deletions test/mails/pgp.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
Content-Type: multipart/alternative;
boundary="------------030903060301010207080901"

This is a multi-part message in MIME format.
--------------030903060301010207080901
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit




-------- Mensaje reenviado --------
Asunto: activació de l'entorn segur
Fecha: Tue, 12 Jan 2016 07:56:42 +0100
De: Usuari Qualsevol <usuari.qualsevol@example.com>
Para: mailtoticket@example.com



Hola,

Us volia demanar... la desactivació de la connexió a Internet (em penso que

Grà cies,

--
Salut!

Usuari

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1

CFsAnHUBBh3XTpN30HrfOUaGVpxYsX9xlNOMlluEioZwSBHlL0/42g5VjCYxY21R
mQINBO1W3yxOxAJ/x3h0bGdXfCKuoA/tKIUMO97D2/5mPcOgXAVYALUafLv7y1V0
DwFjA9T1ONO5LR0iknc=
=1gTk
-----END PGP PUBLIC KEY BLOCK-----



--

E-mail : mailtoticket@example.com

======================================================================

Abans d'imprimir aquest missatge, si us plau, assegureu-vos que sigui
necessari. El medi ambient és cosa de tots.


--


E-mail : usuari@example.com
Web : http://suport.example.com/

======================================================================

Abans d'imprimir aquest missatge, si us plau, assegureu-vos que sigui
necessari. El medi ambient és cosa de tots.


--------------030903060301010207080901
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-forward-container"><br>
<br>
-------- Mensaje reenviado --------
<table class="moz-email-headers-table" border="0" cellpadding="0"
cellspacing="0">
<tbody>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Asunto:
</th>
<td>activació de l'entorn segur</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Fecha: </th>
<td>Tue, 12 Jan 2016 07:56:42 +0100</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">De: </th>
<td>Jordi Delgado <a class="moz-txt-link-rfc2396E" href="mailto:usuari.qualsevol@example.com">&lt;usuari.qualsevol@example.com&gt;</a></td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Para: </th>
<td><a class="moz-txt-link-abbreviated" href="mailto:mailtoticket@example.com">mailtoticket@example.com</a></td>
</tr>
</tbody>
</table>
<br>
<br>
<pre>Hola,

Us volia demanar...

Grà cies,

--
Salut!

Usuari

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1

CFsAnHUBBh3XTpN30HrfOUaGVpxYsX9xlNOMlluEioZwSBHlL0/42g5VjCYxY21R
mQINBO1W3yxOxAJ/x3h0bGdXfCKuoA/tKIUMO97D2/5mPcOgXAVYALUafLv7y1V0
DwFjA9T1ONO5LR0iknc=
=1gTk
-----END PGP PUBLIC KEY BLOCK-----


</pre>
<br>
<pre class="moz-signature" cols="72">--

E-mail : <a class="moz-txt-link-abbreviated" href="mailto:mailtoticket@example.com">mailtoticket@example.com</a>

======================================================================

Abans d'imprimir aquest missatge, si us plau, assegureu-vos que sigui
necessari. El medi ambient és cosa de tots.


</pre>
<br>
</div>
<br>
<br>
<pre class="moz-signature" cols="72">--

E-mail : <a class="moz-txt-link-abbreviated" href="mailto:usuari@example.com">usuari@example.com</a>

======================================================================

Abans d'imprimir aquest missatge, si us plau, assegureu-vos que sigui
necessari. El medi ambient és cosa de tots.


</pre>
</body>
</html>

--------------030903060301010207080901--
34 changes: 34 additions & 0 deletions test/mails/reply-attachment.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="------------000908000400050109010407"

This is a multi-part message in MIME format.
--------------000908000400050109010407
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Ni cas!

El 05/12/2014 15:33, mailtoticket@example.com escribió El tiquet 99999 amb prioritat *2:Mitja* sol·licitat per *USUARI QUALSEVOL* ha
> estat assignat a l'equip *PROVA*.
>
> Tiquet: *Ticket de prova que no s'ha d'esborrar*
>
> Descripció
> Aquest ticket es per provar un tema d'attachments i replys
>
>
>
>

--------------000908000400050109010407
Content-Type: text/plain; charset=UTF-8;
name="prova.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="prova.txt"

cHJvdmEgaW5MYWI=
--------------000908000400050109010407--


8 changes: 2 additions & 6 deletions test/mails/reply-mutipart-alternative.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,9 @@ El 09/12/2014 15:46, mailtoticket@example.com escribió
> Descripció
> hola
>
>
>
> Per accedir al tiquet prem sobre el segünllaç> 549720 - prova reply



--
--

USUARI QUALSEVOL
--------------090609040105000108020504
Expand Down Expand Up @@ -68,7 +64,7 @@ Content-Transfer-Encoding: 8bit
alert("hola");
</script>
<br>
<pre class="moz-signature" cols="72">--
<pre class="moz-signature" cols="72">--

USUARI QUALSEVOL
</pre>
Expand Down
23 changes: 23 additions & 0 deletions test/mails/reply-no-html.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
MIME-Version: 1.0
Content-Type: text/plain;charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Priority: 3 (Normal)
Importance: Normal

Hola,


Ok, dema em passo.

Usuari

> <p>Bon dia,<br />
> <br />
> Us informem que s'ha actualitzat el contingut del vostre tiquet
> <strong>999999</strong> (<strong>Programari docent laboratoris
> d'informàtica</strong>) que es troba en procés de
> resolució amb el següent comentari:<br />
> <br />



Loading