tests: add checks on editing invoices cell
This commit is contained in:
parent
e086e49092
commit
a5c674c0ca
|
@ -6,7 +6,8 @@ from webtest import TestApp
|
|||
import pytest
|
||||
|
||||
import eopayment
|
||||
from combo.apps.lingo.models import Regie, BasketItem, Transaction
|
||||
from combo.data.models import Page
|
||||
from combo.apps.lingo.models import Regie, BasketItem, Transaction, ActiveItems
|
||||
from decimal import Decimal
|
||||
|
||||
pytestmark = pytest.mark.django_db
|
||||
|
@ -126,3 +127,52 @@ def test_download_transaction(app, admin_user):
|
|||
assert Decimal(row[4]) == Decimal(trans1.amount)
|
||||
assert row[5] == b_item.subject
|
||||
assert Decimal(row[6]) == b_item.amount
|
||||
|
||||
def test_configure_invoices_cell(app, admin_user):
|
||||
page = Page(title='xxx', slug='test', template_name='standard')
|
||||
page.save()
|
||||
|
||||
app = login(app)
|
||||
resp = app.get('/manage/pages/%s/' % page.id, status=200)
|
||||
assert not 'lingo' in resp.content
|
||||
|
||||
regie = Regie()
|
||||
regie.label = 'Test'
|
||||
regie.slug = 'test'
|
||||
regie.description = 'test'
|
||||
regie.save()
|
||||
|
||||
resp = app.get('/manage/pages/%s/' % page.id, status=200)
|
||||
assert 'lingo' in resp.content
|
||||
assert not 'lingo_activeitems' in resp.content
|
||||
|
||||
regie.webservice_url = 'http://example.net/'
|
||||
regie.save()
|
||||
|
||||
resp = app.get('/manage/pages/%s/' % page.id, status=200)
|
||||
assert 'lingo_activeitems' in resp.content
|
||||
|
||||
cell = ActiveItems(regie='remote', page=page, placeholder='content', order=0)
|
||||
cell.save()
|
||||
resp = app.get('/manage/pages/%s/' % page.id, status=200)
|
||||
assert 'clingo_activeitems-%s-regie' % cell.id not in resp.form.fields
|
||||
assert 'clingo_activeitems-%s-title' % cell.id in resp.form.fields
|
||||
|
||||
regie2 = Regie()
|
||||
regie2.label = 'Test2'
|
||||
regie2.slug = 'test2'
|
||||
regie2.description = 'test2'
|
||||
regie2.webservice_url = 'http://example.net/'
|
||||
regie2.save()
|
||||
|
||||
resp = app.get('/manage/pages/%s/' % page.id, status=200)
|
||||
assert 'clingo_activeitems-%s-regie' % cell.id in resp.form.fields
|
||||
assert 'clingo_activeitems-%s-title' % cell.id in resp.form.fields
|
||||
options = [x[2] for x in resp.form['clingo_activeitems-%s-regie' % cell.id].options]
|
||||
assert 'All' in options
|
||||
assert regie.label in options
|
||||
assert regie2.label in options
|
||||
|
||||
resp.form['clingo_activeitems-%s-regie' % cell.id].value = 'test2'
|
||||
resp.form.submit()
|
||||
assert ActiveItems.objects.get(id=cell.id).regie == regie2.slug
|
||||
|
|
Loading…
Reference in New Issue