Skip to content

Commit

Permalink
[IMP] event_mail: increase tests coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
fuentes73 authored and ernestotejeda committed Oct 26, 2021
1 parent ca56469 commit 3a19537
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 57 deletions.
10 changes: 5 additions & 5 deletions event_mail/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Event Mail
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fevent-lightgray.png?logo=github
:target: https://github.com/OCA/event/tree/12.0/event_mail
:target: https://github.com/OCA/event/tree/13.0/event_mail
:alt: OCA/event
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/event-12-0/event-12-0-event_mail
:target: https://translation.odoo-community.org/projects/event-13-0/event-13-0-event_mail
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/199/12.0
:target: https://runbot.odoo-community.org/runbot/199/13.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -54,7 +54,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/event/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/event/issues/new?body=module:%20event_mail%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/event/issues/new?body=module:%20event_mail%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -87,6 +87,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/event <https://github.com/OCA/event/tree/12.0/event_mail>`_ project on GitHub.
This module is part of the `OCA/event <https://github.com/OCA/event/tree/13.0/event_mail>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
73 changes: 25 additions & 48 deletions event_mail/i18n/event_mail.pot
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * event_mail
# * event_mail
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand All @@ -15,23 +15,9 @@ msgstr ""

#. module: event_mail
#: model_terms:ir.ui.view,arch_db:event_mail.res_config_settings_view_form
msgid "<span class=\"o_form_label\">Template Mail Scheduler</span>\n"
" <span class=\"fa fa-lg fa-envelope\" title=\"Values set here are company-specific.\" aria-label=\"Values set here are company-specific.\" groups=\"base.group_multi_company\" role=\"img\"/>"
msgstr ""

#. module: event_mail
#: selection:event.mail.scheduler.template,interval_type:0
msgid "After each registration"
msgstr ""

#. module: event_mail
#: selection:event.mail.scheduler.template,interval_type:0
msgid "After the event"
msgstr ""

#. module: event_mail
#: selection:event.mail.scheduler.template,interval_type:0
msgid "Before the event"
msgid ""
"<span class=\"o_form_label\">Template Mail Scheduler</span>\n"
" <span class=\"fa fa-lg fa-envelope\" title=\"Values set here are company-specific.\" aria-label=\"Values set here are company-specific.\" groups=\"base.group_multi_company\" role=\"img\"/>"
msgstr ""

#. module: event_mail
Expand All @@ -56,11 +42,6 @@ msgstr ""
msgid "Created on"
msgstr ""

#. module: event_mail
#: selection:event.mail.scheduler.template,interval_unit:0
msgid "Day(s)"
msgstr ""

#. module: event_mail
#: model:ir.model.fields,field_description:event_mail.field_event_mail_scheduler_template__display_name
#: model:ir.model.fields,field_description:event_mail.field_event_mail_template__display_name
Expand Down Expand Up @@ -100,8 +81,8 @@ msgid "Event Mail Template"
msgstr ""

#. module: event_mail
#: selection:event.mail.scheduler.template,interval_unit:0
msgid "Hour(s)"
#: model:ir.model,name:event_mail.model_event_mail_scheduler_template
msgid "Event mail scheduler template"
msgstr ""

#. module: event_mail
Expand All @@ -110,11 +91,6 @@ msgstr ""
msgid "ID"
msgstr ""

#. module: event_mail
#: selection:event.mail.scheduler.template,interval_unit:0
msgid "Immediately"
msgstr ""

#. module: event_mail
#: model:ir.model.fields,field_description:event_mail.field_event_mail_scheduler_template__interval_nbr
msgid "Interval"
Expand Down Expand Up @@ -185,13 +161,13 @@ msgid "Mail options"
msgstr ""

#. module: event_mail
#: selection:event.mail.scheduler.template,interval_unit:0
msgid "Month(s)"
#: model:ir.model.fields,field_description:event_mail.field_event_mail_template__name
msgid "Name"
msgstr ""

#. module: event_mail
#: model:ir.model.fields,field_description:event_mail.field_event_mail_template__name
msgid "Name"
#: model:ir.model.fields,field_description:event_mail.field_event_mail_scheduler_template__sms_template_id
msgid "SMS Template"
msgstr ""

#. module: event_mail
Expand All @@ -204,6 +180,11 @@ msgstr ""
msgid "Scheduling templates for events"
msgstr ""

#. module: event_mail
#: model:ir.model.fields,field_description:event_mail.field_event_mail_scheduler_template__notification_type
msgid "Send"
msgstr ""

#. module: event_mail
#: model:ir.model.fields,field_description:event_mail.field_event_mail_scheduler_template__done
msgid "Sent"
Expand All @@ -219,9 +200,16 @@ msgstr ""
msgid "Template Mail Scheduler"
msgstr ""

#. module: event_mail
#: model:ir.model.fields,help:event_mail.field_event_mail_scheduler_template__sms_template_id
msgid ""
"This field contains the template of the SMS that will be automatically sent"
msgstr ""

#. module: event_mail
#: model:ir.model.fields,help:event_mail.field_event_mail_scheduler_template__template_id
msgid "This field contains the template of the mail that will be automatically sent"
msgid ""
"This field contains the template of the mail that will be automatically sent"
msgstr ""

#. module: event_mail
Expand All @@ -233,14 +221,3 @@ msgstr ""
#: model:ir.model.fields,field_description:event_mail.field_event_mail_scheduler_template__interval_unit
msgid "Unit"
msgstr ""

#. module: event_mail
#: selection:event.mail.scheduler.template,interval_unit:0
msgid "Week(s)"
msgstr ""

#. module: event_mail
#: model:ir.model,name:event_mail.model_event_mail_scheduler_template
msgid "event.mail.scheduler.template"
msgstr ""

6 changes: 3 additions & 3 deletions event_mail/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Event Mail</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/event/tree/12.0/event_mail"><img alt="OCA/event" src="https://img.shields.io/badge/github-OCA%2Fevent-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/event-12-0/event-12-0-event_mail"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/199/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/event/tree/13.0/event_mail"><img alt="OCA/event" src="https://img.shields.io/badge/github-OCA%2Fevent-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/event-13-0/event-13-0-event_mail"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/199/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows to define mail settings for events. By default the emails
scheduler has been deactivated.
You can create mail scheduler templates for events and select one by default
Expand Down Expand Up @@ -403,7 +403,7 @@ <h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/event/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/event/issues/new?body=module:%20event_mail%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/event/issues/new?body=module:%20event_mail%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -434,7 +434,7 @@ <h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/event/tree/12.0/event_mail">OCA/event</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/event/tree/13.0/event_mail">OCA/event</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
38 changes: 37 additions & 1 deletion event_mail/tests/test_event_mail.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2017 Tecnativa - Sergio Teruel <sergio.teruel@tecnativa.com>
# Copyright 2020 Studio73 - Pablo Fuentes <pablo@studio73.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import SavepointCase
from odoo.tests.common import Form, SavepointCase


class EventMailCase(SavepointCase):
Expand Down Expand Up @@ -90,3 +91,38 @@ def test_event_template_no_config(self):
0,
"Event Mail: mails scheduler no created for this event",
)

def test_event_type(self):
online_type_id = self.env["event.type"].create(
{"name": "Online", "is_online": "True", "use_mail_schedule": "False"}
)
self.assertFalse(
online_type_id.event_type_mail_ids.exists(), "Musn't be 'Mail Schedule'",
)
with Form(self.env["event.event"]) as event_form:
event_form.name = "Event test"
event_form.date_begin = "2020-10-01"
event_form.date_end = "2020-11-01"
event_form.auto_confirm = False
event_form.is_online = False
event_form.event_type_id = online_type_id
self.assertTrue(event_form.is_online, "Online event should be true")

def test_company_event_type(self):
event_config = (
self.env["res.config.settings"]
.sudo()
.create({"event_mail_template_id": self.template2.id})
)
event_config.execute()
physical_type_id = self.env["event.type"].create(
{"name": "Physical", "is_online": "False", "use_mail_schedule": "False"}
)
self.assertTrue(
physical_type_id.event_type_mail_ids.exists(), "Must be 'Mail Schedule'",
)
self.assertEqual(
len(physical_type_id.event_type_mail_ids),
len(self.env.company.event_mail_template_id.scheduler_template_ids),
"Must be same number of 'Mail Schedule' as in company default template",
)

0 comments on commit 3a19537

Please sign in to comment.