Skip to content

Commit

Permalink
Closes #515
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe Álvarez committed Aug 25, 2016
1 parent f9b894a commit 98455e6
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
6 changes: 3 additions & 3 deletions backend_staff/tests/mails_for_staff_tests.py
Expand Up @@ -39,13 +39,13 @@ def test_send_mails_to_staff_when_new_comments(self):

def test_send_mails_to_staff_when_new_proposal(self):
context = {
'proposal': self.proposal,
'temporary_data': self.temporary_data,
}
send_mails_to_staff(context, 'notify_staff_new_proposal')
self.assertEquals(len(mail.outbox), 1)
the_mail = mail.outbox[0]
self.assertIn(self.staff1.email, the_mail.to)
self.assertIn(self.staff2.email, the_mail.to)
self.assertIn(str(self.proposal.id), the_mail.body)
self.assertIn(self.proposal.title, the_mail.body)
self.assertIn(self.proposal.area.name, the_mail.subject)
self.assertIn(self.temporary_data.get_title(), the_mail.body)
self.assertIn(self.temporary_data.area.name, the_mail.subject)
18 changes: 16 additions & 2 deletions popular_proposal/tests/wizard_tests.py
Expand Up @@ -148,7 +148,14 @@ def test_post_data_to_the_wizard(self):
self.assertEquals(response.context['area'], self.arica)
self.assertEquals(temporary_data.proposer, self.feli)
self.assertEquals(temporary_data.area, self.arica)
self.assertEquals(len(mail.outbox), original_amount + 1)
self.assertEquals(len(mail.outbox), original_amount + 2)

the_mail = mail.outbox[original_amount + 1]
self.assertIn(self.fiera.email, the_mail.to)
self.assertIn(self.feli.email, the_mail.to)
self.assertIn(str(temporary_data.id), the_mail.body)
self.assertIn(temporary_data.get_title(), the_mail.body)
self.assertIn(temporary_data.area.name, the_mail.subject)

def test_user_should_accept_terms_and_conditions(self):
list_ = get_form_list()
Expand Down Expand Up @@ -194,4 +201,11 @@ def test_full_wizard(self):
self.assertEquals(response.context['area'], self.arica)
self.assertEquals(temporary_data.proposer, self.feli)
self.assertEquals(temporary_data.area, self.arica)
self.assertEquals(len(mail.outbox), original_amount + 1)
self.assertEquals(len(mail.outbox), original_amount + 2)

the_mail = mail.outbox[original_amount + 1]
self.assertIn(self.fiera.email, the_mail.to)
self.assertIn(self.feli.email, the_mail.to)
self.assertIn(str(temporary_data.id), the_mail.body)
self.assertIn(temporary_data.get_title(), the_mail.body)
self.assertIn(temporary_data.area.name, the_mail.subject)
3 changes: 3 additions & 0 deletions popular_proposal/views.py
Expand Up @@ -26,6 +26,7 @@
from popular_proposal.forms import ProposalAreaFilterForm
from popular_proposal.filters import ProposalAreaFilter
from votainteligente.view_mixins import EmbeddedViewBase
from votainteligente.send_mails import send_mails_to_staff


class ProposalCreationView(FormView):
Expand Down Expand Up @@ -169,6 +170,7 @@ def done(self, form_list, **kwargs):
area=self.area,
data=data)
t_data.notify_new()
send_mails_to_staff({'temporary_data': t_data}, 'notify_staff_new_proposal')
return render_to_response('popular_proposal/wizard/done.html', {
'popular_proposal': t_data,
'area': self.area
Expand Down Expand Up @@ -209,6 +211,7 @@ def done(self, form_list, **kwargs):
context.update({'popular_proposal': temporary_data,
'area': area
})
send_mails_to_staff({'temporary_data': temporary_data}, 'notify_staff_new_proposal')
return render_to_response('popular_proposal/wizard/done.html',
context)

Expand Down
@@ -1,10 +1,10 @@
Oe!!
Cacha que {{proposal.proposer}} creó una propuesta ciudadana.
Cacha que {{temporary_data.proposer}} creó una propuesta ciudadana.

Los datos son:

el id de la propuesta es: {{proposal.id}}
el título de la propuesta es: {{proposal.title}}
el id de la propuesta es: {{temporary_data.id}}
el título de la propuesta es: {{temporary_data.get_title}}


Recuerda que te queremos más que la chucha por eso tienes un <3 ahí donde dice Perfil del Staff.
Expand Down
@@ -1 +1 @@
Oe! cacha que hay una nueva propuesta para {{proposal.area}}
Oe! cacha que hay una nueva propuesta para {{temporary_data.area}}

0 comments on commit 98455e6

Please sign in to comment.