Fix kfet tests

- and add test for `kfet_config.subvention_cof`
This commit is contained in:
Aurélien Delobelle 2017-04-10 11:52:57 +02:00
parent c228416809
commit 5d6012b6bd
2 changed files with 11 additions and 4 deletions

View file

@ -22,13 +22,20 @@ class ConfigTest(TestCase):
def test_get(self): def test_get(self):
self.assertTrue(hasattr(kfet_config, 'subvention_cof')) self.assertTrue(hasattr(kfet_config, 'subvention_cof'))
def test_subvention_cof(self):
reduction_cof = Decimal('20')
subvention_cof = Decimal('25')
kfet_config.set(reduction_cof=reduction_cof)
self.assertEqual(kfet_config.subvention_cof, subvention_cof)
def test_set_decimal(self): def test_set_decimal(self):
"""Test field of decimal type.""" """Test field of decimal type."""
subvention_cof = Decimal('10') reduction_cof = Decimal('10')
# IUT # IUT
kfet_config.set(subvention_cof=subvention_cof) kfet_config.set(reduction_cof=reduction_cof)
# check # check
self.assertEqual(kfet_config.subvention_cof, subvention_cof) self.assertEqual(kfet_config.reduction_cof, reduction_cof)
def test_set_modelinstance(self): def test_set_modelinstance(self):
"""Test field of model instance type.""" """Test field of model instance type."""

View file

@ -5,7 +5,7 @@ from unittest.mock import patch
from django.test import TestCase, Client from django.test import TestCase, Client
from django.contrib.auth.models import User, Permission from django.contrib.auth.models import User, Permission
from .models import Account, Article, ArticleCategory from kfet.models import Account, Article, ArticleCategory
class TestStats(TestCase): class TestStats(TestCase):