forked from DGNum/gestioCOF
Tests of kfet config views pass
This commit is contained in:
parent
414b0eb433
commit
b4b15ab371
1 changed files with 16 additions and 8 deletions
|
@ -1653,7 +1653,7 @@ class SettingsListViewTests(ViewTestCaseMixin, TestCase):
|
|||
def users_extra(self):
|
||||
return {
|
||||
'team1': create_team('team1', '101', perms=[
|
||||
'kfet.change_settings',
|
||||
'kfet.see_config',
|
||||
]),
|
||||
}
|
||||
|
||||
|
@ -1686,26 +1686,34 @@ class SettingsUpdateViewTests(ViewTestCaseMixin, TestCase):
|
|||
def users_extra(self):
|
||||
return {
|
||||
'team1': create_team('team1', '101', perms=[
|
||||
'kfet.change_settings',
|
||||
'kfet.change_config',
|
||||
]),
|
||||
}
|
||||
|
||||
def test_get_ok(self):
|
||||
r = self.client.get(self.url)
|
||||
self.assertequal(r.status_code, 200)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
def test_post_ok(self):
|
||||
r = self.client.post(self.url, self.post_data)
|
||||
self.assertRedirects(r, reverse('kfet.settings'))
|
||||
# Redirect is skipped because client may lack permissions.
|
||||
self.assertRedirects(
|
||||
r,
|
||||
reverse('kfet.settings'),
|
||||
fetch_redirect_response=False,
|
||||
)
|
||||
|
||||
self.assertDictEqual(dict(kfet_config.list()), {
|
||||
expected_config = {
|
||||
'reduction_cof': Decimal('25'),
|
||||
'addcost_amount': Decimal('0.5'),
|
||||
'addcost_for': self.accounts['user'],
|
||||
'overdraft_duration': timedelta(day=2),
|
||||
'overdraft_duration': timedelta(days=2),
|
||||
'overdraft_amount': Decimal('25'),
|
||||
'kfet_cancel_duration': timedelta(minutes=20),
|
||||
})
|
||||
'cancel_duration': timedelta(minutes=20),
|
||||
}
|
||||
|
||||
for key, expected in expected_config.items():
|
||||
self.assertEqual(getattr(kfet_config, key), expected)
|
||||
|
||||
|
||||
class TransferListViewTests(ViewTestCaseMixin, TestCase):
|
||||
|
|
Loading…
Reference in a new issue