WIP: Aureplop/kpsul js refactor #501

Draft
delobell wants to merge 215 commits from aureplop/kpsul_js_refactor into master
Showing only changes of commit 7e15fd2d9e - Show all commits

View file

@ -4,6 +4,7 @@ from decimal import Decimal
from unittest import mock
from django.contrib.auth.models import Group
from django.core.serializers.json import DjangoJSONEncoder
from django.core.urlresolvers import reverse
from django.test import Client, TestCase
from django.utils import timezone
@ -790,18 +791,23 @@ class CheckoutReadViewTests(ViewTestCaseMixin, TestCase):
self.assertEqual(r.status_code, 200)
content = json.loads(r.content.decode('utf-8'))
json_now = json.dumps(self.now, cls=DjangoJSONEncoder).strip('"')
json_tomorrow = json.dumps(
self.now + timedelta(days=1),
cls=DjangoJSONEncoder
).strip('"')
self.assertEqual(content, {
'id': self.checkout.pk,
'name': 'Checkout',
'balance': '0.00',
'valid_from': '2018-01-12T16:20:00Z',
'valid_to': '2018-01-17T16:20:00Z',
'balance': '10.00',
'valid_from': json_now,
'valid_to': json_tomorrow,
'laststatement': {
'id': self.checkout.statements.all()[0].pk,
'at': '2018-01-12T16:20:00Z',
'balance_new': '0.00',
'balance_old': '0.00',
'at': json_now,
'balance_new': '10.00',
'balance_old': '10.00',
'by': str(self.accounts['team']),
},
})