Commit 20c2fe58 authored by Damien Lespiau's avatar Damien Lespiau
Browse files

testresult: Add mail fields to model



We want to send emails for test results and offer some per-test
configuration knobs to tweak the mailing behaviour.

To start with:
  - send either to the submitter only, or to submitter + mailing list
  - send the email on any result (but pending), just just on failure
Signed-off-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
parent e4cf5a03
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('patchwork', '0008_test_results'),
]
operations = [
migrations.AddField(
model_name='test',
name='mail_condition',
field=models.SmallIntegerField(default=0, choices=[(0, b'always'), (1, b'on failure')]),
),
migrations.AddField(
model_name='test',
name='mail_recipient',
field=models.SmallIntegerField(default=0, choices=[(0, b'none'), (1, b'submitter'), (2, b'mailing list')]),
),
]
......@@ -567,8 +567,34 @@ class EventLog(models.Model):
ordering = ['-event_time']
class Test(models.Model):
# no mail, default so test systems/scripts can have a grace period to
# settle down and give useful results
RECIPIENT_NONE = 0
# send mail only to submitter
RECIPIENT_SUBMITTER = 1
# send mail to submitter and mailing-list in Cc
RECIPIENT_MAILING_LIST = 2
RECIPIENT_CHOICES = (
(RECIPIENT_NONE, 'none'),
(RECIPIENT_SUBMITTER, 'submitter'),
(RECIPIENT_MAILING_LIST, 'mailing list'),
)
# send result mail on any state (but pending)
CONDITION_ALWAYS = 0
# only send result on warning/failure
CONDITION_ON_FAILURE = 1
CONDITION_CHOICES = (
(CONDITION_ALWAYS, 'always'),
(CONDITION_ON_FAILURE, 'on failure'),
)
project = models.ForeignKey(Project)
name = models.CharField(max_length=255)
mail_recipient = models.SmallIntegerField(choices=RECIPIENT_CHOICES,
default=RECIPIENT_NONE)
mail_condition = models.SmallIntegerField(choices=CONDITION_CHOICES,
default=CONDITION_ALWAYS)
class Meta:
unique_together = [('project', 'name')]
......
Markdown is supported
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