mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-27 18:32:16 +00:00
Add VatRate model tests
This commit is contained in:
@@ -73,13 +73,13 @@ DATABASES = {
|
|||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||||
},
|
},
|
||||||
'legacy': {
|
# 'legacy': {
|
||||||
'ENGINE': 'django.db.backends.mysql',
|
# 'ENGINE': 'django.db.backends.mysql',
|
||||||
'HOST': 'alfie.codedinternet.com',
|
# 'HOST': 'alfie.codedinternet.com',
|
||||||
'NAME': 'tec_rigs',
|
# 'NAME': 'tec_rigs',
|
||||||
'USER': 'tec_rigs',
|
# 'USER': 'tec_rigs',
|
||||||
'PASSWORD': 'xMNb(b+Giu]&',
|
# 'PASSWORD': 'xMNb(b+Giu]&',
|
||||||
}
|
# }
|
||||||
}
|
}
|
||||||
|
|
||||||
# User system
|
# User system
|
||||||
|
|||||||
17
RIGS/test_models.py
Normal file
17
RIGS/test_models.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
from RIGS import models
|
||||||
|
|
||||||
|
class VatRateTestCase(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
models.VatRate.objects.create(start_at='2014-03-01',rate=0.20,comment='test1')
|
||||||
|
models.VatRate.objects.create(start_at='2016-03-01',rate=0.15,comment='test2')
|
||||||
|
|
||||||
|
def test_find_correct(self):
|
||||||
|
r = models.VatRate.objects.find_rate('2015-03-01')
|
||||||
|
self.assertEqual(r.comment, 'test1')
|
||||||
|
r = models.VatRate.objects.find_rate('2016-03-01')
|
||||||
|
self.assertEqual(r.comment, 'test2')
|
||||||
|
|
||||||
|
def test_percent_correct(self):
|
||||||
|
r = models.VatRate.objects.get(rate=0.20)
|
||||||
|
self.assertEqual(r.as_percent, 20)
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
|
||||||
Reference in New Issue
Block a user