tipi form: fix control protocol default id (#14519)

Tests fixed.
This commit is contained in:
Serghei Mihai 2017-03-14 16:46:05 +01:00
parent 970fadf03b
commit e202e28792
4 changed files with 8 additions and 5 deletions

View File

@ -27,7 +27,7 @@ class Migration(migrations.Migration):
('title', models.CharField(max_length=150, verbose_name='Title', blank=True)),
('url', models.URLField(default=b'https://www.tipi.budget.gouv.fr/tpa/paiement.web', verbose_name='TIPI payment service URL')),
('regies', models.CharField(help_text='separated by commas', max_length=256, verbose_name='Regies')),
('control_protocol', models.CharField(default=b'1', max_length=8, verbose_name='Control protocol', choices=[(b'pesv2', 'Indigo/PES v2'), (b'rolmre', 'ROLMRE')])),
('control_protocol', models.CharField(default=b'pesv2', max_length=8, verbose_name='Control protocol', choices=[(b'pesv2', 'Indigo/PES v2'), (b'rolmre', 'ROLMRE')])),
('test_mode', models.BooleanField(default=False, verbose_name='Test mode')),
('groups', models.ManyToManyField(to='auth.Group', verbose_name='Groups', blank=True)),
('page', models.ForeignKey(to='data.Page')),

View File

@ -512,7 +512,7 @@ class TipiPaymentFormCell(CellBase):
title = models.CharField(_('Title'), max_length=150, blank=True)
url = models.URLField(_('TIPI payment service URL'), default='https://www.tipi.budget.gouv.fr/tpa/paiement.web')
regies = models.CharField(_('Regies'), help_text=_('separated by commas'), max_length=256)
control_protocol = models.CharField(_('Control protocol'), max_length=8, choices=TIPI_CONTROL_PROCOTOLS, default='1')
control_protocol = models.CharField(_('Control protocol'), max_length=8, choices=TIPI_CONTROL_PROCOTOLS, default='pesv2')
test_mode = models.BooleanField(_('Test mode'), default=False)
template_name = 'lingo/tipi_form.html'

View File

@ -162,7 +162,7 @@ def test_tipi_cell():
cell.regies = "test regie"
cell.order = 0
cell.save()
assert cell.control_protocol == '1'
assert cell.control_protocol == 'pesv2'
assert cell.url == 'https://www.tipi.budget.gouv.fr/tpa/paiement.web'
assert cell.template_name == 'lingo/tipi_form.html'
html = cell.render(Context({}))
@ -176,7 +176,7 @@ def test_tipi_cell():
assert 'id="roldet"' not in html
assert 'data-saisie="M"' in html
cell.control_protocol = '2'
cell.control_protocol = 'rolmre'
cell.test_mode = True
cell.save()
html = cell.render(Context({}))

View File

@ -134,7 +134,10 @@ def test_configure_invoices_cell(app, admin_user):
app = login(app)
resp = app.get('/manage/pages/%s/' % page.id, status=200)
assert not 'lingo' in resp.content
# 2 occurences of tipi payment form should be present
assert resp.content.count('lingo') == 2
assert 'lingo_tipipaymentformcell' in resp.content
regie = Regie()
regie.label = 'Test'